rubyunit 0.4.23 → 0.4.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/TestSuite.rb +1 -0
- data/lib/RubyUnit.rb +1 -1
- data/lib/RubyUnit/Assertions.rb +2 -0
- data/lib/RubyUnit/Assertions/Root.rb +9 -1
- data/lib/RubyUnit/Assertions/Variables.rb +51 -0
- data/lib/RubyUnit/Report.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3803155b1bf2e7d8d4625e2b4fe954e1d731b512
|
4
|
+
data.tar.gz: dc4a21f703bd88fd83287ca9a49542ab9a9974c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf28bd7bcf9ba89c492ffe5b5c6859750be325591046e68033891073967e6c483a5c228c2b4e67d1bb82c0abca161ad561f49a19f63a52f1102bb22e0f4b71fe
|
7
|
+
data.tar.gz: 03e28da972fc0c61816a78fe1dd49d96deefcf5251f6f5d44d450aacf0d41494846330b38cb263c25fbee644ae47156ecda1f142e9f383fe662060c525894fda
|
data/TestSuite.rb
CHANGED
@@ -9,6 +9,7 @@ $:.unshift("#{path}/lib") unless ARGV.include? '--gem'
|
|
9
9
|
require 'RubyUnit'
|
10
10
|
|
11
11
|
RubyUnit.debug = true if ARGV.include? '--debug'
|
12
|
+
RubyUnit::Report.trace = false if ARGV.include? '--no-trace'
|
12
13
|
|
13
14
|
# Automatically load Test Sets
|
14
15
|
RubyUnit::TestSuite.new Dir['tests/TS_*.rb']
|
data/lib/RubyUnit.rb
CHANGED
data/lib/RubyUnit/Assertions.rb
CHANGED
@@ -4,6 +4,7 @@ require_relative 'Assertions/Collections' # Collection assertions
|
|
4
4
|
require_relative 'Assertions/Comparisons' # Comparison assertions
|
5
5
|
require_relative 'Assertions/Exceptions' # Exception assertions
|
6
6
|
require_relative 'Assertions/Methods' # Method assertions
|
7
|
+
require_relative 'Assertions/Variables' # Variable assertions
|
7
8
|
|
8
9
|
module RubyUnit
|
9
10
|
##
|
@@ -34,5 +35,6 @@ module RubyUnit
|
|
34
35
|
include Assertions::Comparisons
|
35
36
|
include Assertions::Exceptions
|
36
37
|
include Assertions::Methods
|
38
|
+
include Assertions::Variables
|
37
39
|
end
|
38
40
|
end
|
@@ -42,6 +42,12 @@ module RubyUnit
|
|
42
42
|
result
|
43
43
|
end
|
44
44
|
|
45
|
+
def __reject_block error = '', message = nil, data = {} # :nodoc:
|
46
|
+
Assertions.add_assertion
|
47
|
+
result = block_given? ? yield : false
|
48
|
+
__fail error, message, data if result
|
49
|
+
!result
|
50
|
+
end
|
45
51
|
##
|
46
52
|
# This is now a wrapper for __assert_block so it can be called 'nicely' in one line
|
47
53
|
# * raises RubyUnit::AssertionFailure unless _value_ is true
|
@@ -86,7 +92,9 @@ module RubyUnit
|
|
86
92
|
# __reject value, 'Failed to assert value is not true', message, {:value=>value}
|
87
93
|
#
|
88
94
|
def __reject value, error, message, data # :nodoc:
|
89
|
-
|
95
|
+
__reject_block error, message, data do
|
96
|
+
value
|
97
|
+
end
|
90
98
|
end
|
91
99
|
end
|
92
100
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require_relative 'Root'
|
2
|
+
|
3
|
+
module RubyUnit
|
4
|
+
module Assertions
|
5
|
+
module Variables
|
6
|
+
include RubyUnit::AssertionMessage
|
7
|
+
include Root
|
8
|
+
|
9
|
+
def assertInstanceVariableDefined object, variable, message = nil
|
10
|
+
__assert_block ASSERT_INSTANCE_VARIABLE_DEFINED_ERROR, message, {:object=>object, :variable=>variable} do
|
11
|
+
object.instance_variables.include? variable
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def assertInstanceVariableNotDefined object, variable, message = nil
|
16
|
+
__reject_block ASSERT_INSTANCE_VARIABLE_NOT_DEFINED_ERROR, message, {:object=>object, :variable=>variable} do
|
17
|
+
object.instance_variables.include? variable
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def assertInstanceVariableEqual expected, object, variable, message = nil
|
22
|
+
__assert_block ASSERT_INSTANCE_VARIABLE_VALUE_ERROR, message, {:expected=>expected, :object=>object, :variable=>variable} do
|
23
|
+
expected == __instance_variable(object, variable)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def assertInstanceVariableNotEqual expected, object, variable, message = nil
|
28
|
+
__assert_block ASSERT_INSTANCE_VARIABLE_NOT_VALUE_ERROR, message, {:expected=>expected, :object=>object, :variable=>variable} do
|
29
|
+
expected != __instance_variable(object, variable)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def assertInstanceVariableKindOf klass, object, variable, message = nil
|
34
|
+
__assert_block ASSERT_INSTANCE_VARIABLE_KIND_OF_ERROR, message, {:class=>klass, :object=>object, :variable=>variable} do
|
35
|
+
__instance_variable(object, variable).kind_of? klass
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def assertInstanceVariableNotKindOf klass, object, variable, message = nil
|
40
|
+
__reject_block ASSERT_INSTANCE_VARIABLE_NOT_KIND_OF_ERROR, message, {:class=>klass, :object=>object, :variable=>variable} do
|
41
|
+
__instance_variable(object, variable).kind_of? klass
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
def __instance_variable object, variable
|
47
|
+
object.instance_variable_get "@#{variable}".to_sym
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
data/lib/RubyUnit/Report.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubyunit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Clower
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -53,6 +53,7 @@ files:
|
|
53
53
|
- lib/RubyUnit/Assertions/Exceptions.rb
|
54
54
|
- lib/RubyUnit/Assertions/Methods.rb
|
55
55
|
- lib/RubyUnit/Assertions/Root.rb
|
56
|
+
- lib/RubyUnit/Assertions/Variables.rb
|
56
57
|
- lib/RubyUnit/IncompleteTest.rb
|
57
58
|
- lib/RubyUnit/Report.rb
|
58
59
|
- lib/RubyUnit/Result.rb
|