rubyunit 0.3.16 → 0.3.17
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/README.md +1 -1
- data/lib/RubyUnit/Assertions/Basic.rb +111 -108
- data/lib/RubyUnit/Assertions/Classes.rb +216 -0
- data/lib/RubyUnit/Assertions/Collections.rb +105 -0
- data/lib/RubyUnit/Assertions/Comparisons.rb +205 -0
- data/lib/RubyUnit/Assertions/Exceptions.rb +122 -0
- data/lib/RubyUnit/Assertions/Methods.rb +162 -0
- data/lib/RubyUnit/Assertions/Root.rb +93 -0
- data/lib/RubyUnit/Assertions.rb +22 -97
- data/lib/RubyUnit.rb +16 -9
- data/tests/AssertionFailure/TC_Class.rb +8 -3
- data/tests/AssertionFailure/TC_Instance.rb +13 -26
- data/tests/AssertionFailure/data/Class.rb +13 -0
- data/tests/AssertionFailure/data/Instance.rb +9 -10
- data/tests/Assertions/{TC_Class.rb → TC_Classes.rb} +3 -4
- data/tests/Assertions/TC_Collections.rb +13 -0
- data/tests/Assertions/TC_Comparisons.rb +13 -0
- data/tests/Assertions/TC_Exceptions.rb +13 -0
- data/tests/Assertions/TC_Methods.rb +13 -0
- data/tests/Assertions/data/Basic.rb +2 -2
- data/tests/Assertions/data/{Class.rb → Classes.rb} +1 -1
- data/tests/Assertions/data/Collections.rb +13 -0
- data/tests/Assertions/data/Comparisons.rb +7 -0
- data/tests/Assertions/data/Exceptions.rb +7 -0
- data/tests/Assertions/data/Methods.rb +7 -0
- data/tests/RubyUnit/TC_GemInfo.rb +4 -3
- data/tests/RubyUnit/TC_RubyUnit.rb +8 -7
- data/tests/RubyUnit/data/GemInfo.rb +1 -1
- data/tests/RubyUnit/data/RubyUnit.rb +9 -2
- data/tests/TS_Assertions.rb +2 -4
- metadata +20 -12
- data/lib/RubyUnit/Assertions/Class.rb +0 -198
- data/lib/RubyUnit/Assertions/Collection.rb +0 -80
- data/lib/RubyUnit/Assertions/Comparison.rb +0 -200
- data/lib/RubyUnit/Assertions/Exception.rb +0 -105
- data/lib/RubyUnit/Assertions/Method.rb +0 -157
- data/tests/Assertions/TC_Comparison.rb +0 -13
- data/tests/Assertions/data/Comparison.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5d35957bc44ace4839322331916d2a7bd7e40e9
|
4
|
+
data.tar.gz: 3aa1001b5357db11dc3101168039128f354c697b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06388c102cf2b807cd11c64ca2d4f05c5158090f71bad93f948f4cfb855a191f028e2c7f9b978bc640679da8cb33373d06e75abe8de1ab0c62e462e323d3f679
|
7
|
+
data.tar.gz: 2771b688763f6c1d7869802b69932fc2ae399c6daf576cae79efde2f617ab97709ede6af632042204b71e4b2d4ea8edfdb9b866253f7f98bd9d3c05006719181
|
data/README.md
CHANGED
@@ -16,7 +16,7 @@ RubyUnit
|
|
16
16
|
Unit testing and test-driven development is a crucial part of the software
|
17
17
|
development life cycle. This tool is intended to make development and
|
18
18
|
testing in Ruby easier on everyone. RubyUnit is also designed to with a focus
|
19
|
-
on data-driven testing.
|
19
|
+
on data-driven testing and meta-programming.
|
20
20
|
|
21
21
|
### Install
|
22
22
|
|
@@ -1,121 +1,124 @@
|
|
1
|
+
require_relative 'Root'
|
2
|
+
|
1
3
|
module RubyUnit
|
2
4
|
module Assertions
|
3
|
-
|
5
|
+
module Basic
|
6
|
+
include RubyUnit::AssertionMessage
|
7
|
+
include Assertions::Root
|
4
8
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
build_message FAILING, message, data
|
9
|
+
##
|
10
|
+
# Fail the test. This is used when some conditioned outside the test warrants
|
11
|
+
# a test failure.
|
12
|
+
# * This is likely an indication of something unexpected or missing functionality
|
13
|
+
# * raises RubyUnit::AssertionFailure
|
14
|
+
#
|
15
|
+
# message::
|
16
|
+
# The message provided to be reported for a failure
|
17
|
+
#
|
18
|
+
# data::
|
19
|
+
# The data associated with assertion
|
20
|
+
#
|
21
|
+
# fail "I wasn't expecting the moon to fall into Lake Michigan" # => fail
|
22
|
+
#
|
23
|
+
def fail message = nil, data = {}
|
24
|
+
__assert_block FAILING, message, data
|
22
25
|
end
|
23
|
-
end
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
27
|
+
##
|
28
|
+
# Assert that a test condition is true.
|
29
|
+
# * raises RubyUnit::AssertionFailure if _value_ is false or nil
|
30
|
+
#
|
31
|
+
# value::
|
32
|
+
# The value that is being checked by the assertion
|
33
|
+
#
|
34
|
+
# message::
|
35
|
+
# The message provided to be reported for a failure
|
36
|
+
#
|
37
|
+
# assert false, "This will fail" # => fail
|
38
|
+
#
|
39
|
+
def assert value, message = nil
|
40
|
+
__assert value, ASSERT_ERROR, message, {:value=>value}
|
41
|
+
end
|
40
42
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
43
|
+
##
|
44
|
+
# Assert that a test condition is false.
|
45
|
+
# * raises RubyUnit::AssertionFailure unless _value_ is false or nil
|
46
|
+
#
|
47
|
+
# value::
|
48
|
+
# The value that is being checked by the assertion
|
49
|
+
#
|
50
|
+
# message::
|
51
|
+
# The message provided to be reported for a failure
|
52
|
+
#
|
53
|
+
# assertNot true, "This will fail" # => fail
|
54
|
+
#
|
55
|
+
def assertNot value, message = nil
|
56
|
+
__reject value, ASSERT_NOT_ERROR, message, {:value=>value}
|
57
|
+
end
|
56
58
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
59
|
+
##
|
60
|
+
# Assert that a test condition is exactly true.
|
61
|
+
# * raises RubyUnit::AssertionFailure unless _value_ is true
|
62
|
+
#
|
63
|
+
# value::
|
64
|
+
# The value that is being checked by the assertion
|
65
|
+
#
|
66
|
+
# message::
|
67
|
+
# The message provided to be reported for a failure
|
68
|
+
#
|
69
|
+
# assertTrue false, "This will fail" # => fail
|
70
|
+
#
|
71
|
+
def assertTrue value, message = nil
|
72
|
+
__assert (true == value), ASSERT_TRUE_ERROR, message, {:value=>value}
|
73
|
+
end
|
72
74
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
75
|
+
##
|
76
|
+
# Assert that a test condition is exactly false.
|
77
|
+
# * raises RubyUnit::AssertionFailure unless _value_ is false
|
78
|
+
#
|
79
|
+
# value::
|
80
|
+
# The value that is being checked by the assertion
|
81
|
+
#
|
82
|
+
# message::
|
83
|
+
# The message provided to be reported for a failure
|
84
|
+
#
|
85
|
+
# assertNil true, "This will fail" # => fail
|
86
|
+
#
|
87
|
+
def assertFalse value, message = nil
|
88
|
+
__assert (false == value), ASSERT_FALSE_ERROR, message, {:value=>value}
|
89
|
+
end
|
88
90
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
91
|
+
##
|
92
|
+
# Assert that a test condition is exactly nil.
|
93
|
+
# * raises RubyUnit::AssertionFailure unless _value_ is nil
|
94
|
+
#
|
95
|
+
# value::
|
96
|
+
# The value that is being checked by the assertion
|
97
|
+
#
|
98
|
+
# message::
|
99
|
+
# The message provided to be reported for a failure
|
100
|
+
#
|
101
|
+
# assertNil true, "This will fail" # => fail
|
102
|
+
#
|
103
|
+
def assertNil value, message = nil
|
104
|
+
__assert value.nil?, ASSERT_NIL_ERROR, message, {:value=>value}
|
105
|
+
end
|
104
106
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
107
|
+
##
|
108
|
+
# Assert that a test condition is not nil.
|
109
|
+
# * raises RubyUnit::AssertionFailure if _value_ is nil
|
110
|
+
#
|
111
|
+
# value::
|
112
|
+
# The value that is being checked by the assertion
|
113
|
+
#
|
114
|
+
# message::
|
115
|
+
# The message provided to be reported for a failure
|
116
|
+
#
|
117
|
+
# assertNotNil nil, "This will fail" # => fail
|
118
|
+
#
|
119
|
+
def assertNotNil value, message = nil
|
120
|
+
__reject value.nil?, ASSERT_NOT_NIL_ERROR, message, {:value=>value}
|
121
|
+
end
|
119
122
|
end
|
120
123
|
end
|
121
124
|
end
|
@@ -0,0 +1,216 @@
|
|
1
|
+
require_relative 'Root'
|
2
|
+
|
3
|
+
module RubyUnit
|
4
|
+
module Assertions
|
5
|
+
module Classes
|
6
|
+
include RubyUnit::AssertionMessage
|
7
|
+
include Root
|
8
|
+
|
9
|
+
##
|
10
|
+
# Assert that an object is an instance of the specified class or one of
|
11
|
+
# its descendents.
|
12
|
+
# * raises RubyUnit::AssertionFailure unless _object_ is an instance of
|
13
|
+
# _klass_ or one of its descendents.
|
14
|
+
#
|
15
|
+
# klass::
|
16
|
+
# The class that is expected
|
17
|
+
#
|
18
|
+
# object::
|
19
|
+
# The object that will be checked against _klass_
|
20
|
+
#
|
21
|
+
# message::
|
22
|
+
# The message provided to be reported for a failure
|
23
|
+
#
|
24
|
+
# assertKindOf String, 25, 'Nope, try again.' # => fail
|
25
|
+
#
|
26
|
+
def assertKindOf klass, object, message = nil
|
27
|
+
__assert (object.is_a? klass), ASSERT_KIND_OF_ERROR, message, {:klass=>klass, :object=>object}
|
28
|
+
end
|
29
|
+
|
30
|
+
alias_method :assertIsA, :assertKindOf
|
31
|
+
|
32
|
+
#
|
33
|
+
# Assert that an object is not an instance of the specified class or one of
|
34
|
+
# its descendents.
|
35
|
+
# * raises RubyUnit::AssertionFailure if _object_ is an instance of _exclusion_ or
|
36
|
+
# one of its descendents.
|
37
|
+
#
|
38
|
+
# exclusion::
|
39
|
+
# The class that is excluded
|
40
|
+
#
|
41
|
+
# object::
|
42
|
+
# The object that will be checked against _klass_
|
43
|
+
#
|
44
|
+
# message::
|
45
|
+
# The message provided to be reported for a failure
|
46
|
+
#
|
47
|
+
# assertNotKindOf Numeric, 25, 'Nope, try again.' # => fail
|
48
|
+
#
|
49
|
+
def assertNotKindOf exclusion, object, message = nil
|
50
|
+
__reject (object.is_a? exclusion), ASSERT_NOT_KIND_OF_ERROR, message, {:exclusion=>exclusion, :object=>object}
|
51
|
+
end
|
52
|
+
|
53
|
+
[:assertNotIsA, :assertIsNotA].each do |method|
|
54
|
+
alias_method method, :assertNotKindOf
|
55
|
+
end
|
56
|
+
|
57
|
+
#
|
58
|
+
# Assert that an object is an instance of a specified class
|
59
|
+
# * raises RubyUnit::AssertionFailure unless _object_ is an instance of _klass_.
|
60
|
+
#
|
61
|
+
# klass::
|
62
|
+
# The class that is expected
|
63
|
+
#
|
64
|
+
# object::
|
65
|
+
# The object that will be checked against _klass_
|
66
|
+
#
|
67
|
+
# message::
|
68
|
+
# The message provided to be reported for a failure
|
69
|
+
#
|
70
|
+
# assertInstanceOf Integer, '25', 'So close, but... No.' # => fail
|
71
|
+
#
|
72
|
+
def assertInstanceOf klass, object, message = nil
|
73
|
+
__assert (object.instance_of? klass), ASSERT_INSTANCE_OF_ERROR, message, {:klass=>klass, :object=>object}
|
74
|
+
end
|
75
|
+
|
76
|
+
#
|
77
|
+
# Assert that an object is an instance of a specified class
|
78
|
+
# * raises RubyUnit::AssertionFailure unless _object_ is an instance of _klass_.
|
79
|
+
#
|
80
|
+
# exclusion::
|
81
|
+
# The class that is expected
|
82
|
+
#
|
83
|
+
# object::
|
84
|
+
# The object that will be checked against _klass_
|
85
|
+
#
|
86
|
+
# message::
|
87
|
+
# The message provided to be reported for a failure
|
88
|
+
#
|
89
|
+
# assertNotInstanceOf Integer, 25, 'So close, but... No.' # => fail
|
90
|
+
#
|
91
|
+
def assertNotInstanceOf exclusion, object, message = nil
|
92
|
+
__reject (object.instance_of? exclusion), ASSERT_NOT_INSTANCE_OF_ERROR, message, {:exclusion=>exclusion, :object=>object}
|
93
|
+
end
|
94
|
+
|
95
|
+
#
|
96
|
+
# Assert that a class is a descendent of another class
|
97
|
+
# * raises RubyUnit::AssertionFailure unless _descendent_ is a descendent of +_super+
|
98
|
+
#
|
99
|
+
# _super::
|
100
|
+
# The parent class
|
101
|
+
#
|
102
|
+
# descendent::
|
103
|
+
# The descendent class
|
104
|
+
#
|
105
|
+
# message::
|
106
|
+
# The message provided to be reported for a failure
|
107
|
+
#
|
108
|
+
# assertDescendent Numeric, Exception, 'Nope' # => fail
|
109
|
+
#
|
110
|
+
def assertDescendent _super, descendent, message = nil
|
111
|
+
__assert_descendent ASSERT_DESCENDENT_ERROR, _super, descendent, message do
|
112
|
+
descendent < _super
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
#
|
117
|
+
# Assert that a class is not a descendent of another class
|
118
|
+
# * raises RubyUnit::AssertionFailure if _klass_ is a descendent of _klass_
|
119
|
+
#
|
120
|
+
# klass::
|
121
|
+
# The parent class
|
122
|
+
#
|
123
|
+
# descendent::
|
124
|
+
# The illegal descendent class
|
125
|
+
#
|
126
|
+
# message::
|
127
|
+
# The message provided to be reported for a failure
|
128
|
+
#
|
129
|
+
# assertDescendent StandardError, Exception, 'It is' # => fail
|
130
|
+
#
|
131
|
+
def assertNotDescendent klass, descendent, message = nil
|
132
|
+
__assert_descendent ASSERT_NOT_DESCENDENT_ERROR, klass, descendent, message do
|
133
|
+
not descendent < klass
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
#
|
138
|
+
# Assert that a constant is defined correctly in the correct class
|
139
|
+
# * raises RubyUnit::AssertionFailure unless the constant is defined in
|
140
|
+
# the specified class and it is the correct type and value
|
141
|
+
#
|
142
|
+
# expected::
|
143
|
+
# The value that is expected for the constant
|
144
|
+
#
|
145
|
+
# klass::
|
146
|
+
# The class where the constant should be defined
|
147
|
+
#
|
148
|
+
# konstant::
|
149
|
+
# The name of the constant
|
150
|
+
#
|
151
|
+
# message::
|
152
|
+
# The message provided to be reported for a failure
|
153
|
+
#
|
154
|
+
# assertConst 42, Numbers, 'TWENTYFOUR', 'So dyslexic.' # => fail
|
155
|
+
#
|
156
|
+
def assertConst expected, klass, konstant, message = nil
|
157
|
+
__assert_block ASSERT_CONST_ERROR, message do
|
158
|
+
assertConstDefined klass, konstant, message
|
159
|
+
value = klass.const_get konstant
|
160
|
+
assertKindOf expected.class, value, message
|
161
|
+
assertEqual expected, value, message
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
#
|
166
|
+
# Assert that a constant is defined in the specified class
|
167
|
+
# * raises RubyUnit::AssertionFailure unless the constant is defined in
|
168
|
+
# the specified class
|
169
|
+
#
|
170
|
+
# klass::
|
171
|
+
# The class where the constant should be defined
|
172
|
+
#
|
173
|
+
# konstant::
|
174
|
+
# The name of the constant
|
175
|
+
#
|
176
|
+
# message::
|
177
|
+
# The message provided to be reported for a failure
|
178
|
+
#
|
179
|
+
# assertConstDefined Numbers, 'FORTYTWO', 'Mystery.' # => ??
|
180
|
+
#
|
181
|
+
def assertConstDefined klass, konstant, message = nil
|
182
|
+
__assert (klass.const_defined? konstant), ASSERT_CONST_DEFINED_ERROR, message, {:klass=>klass, :konstant=>konstant}
|
183
|
+
end
|
184
|
+
|
185
|
+
#
|
186
|
+
# Assert that a constant is not defined in the specified class
|
187
|
+
# * raises RubyUnit::AssertionFailure if the constant is defined in
|
188
|
+
# the specified class
|
189
|
+
#
|
190
|
+
# klass::
|
191
|
+
# The class where the constant should not be defined
|
192
|
+
#
|
193
|
+
# konstant::
|
194
|
+
# The name of the constant
|
195
|
+
#
|
196
|
+
# message::
|
197
|
+
# The message provided to be reported for a failure
|
198
|
+
#
|
199
|
+
# assertConstNotDefined Numbers, 'TWENTYFOUR', 'Mystery.' # => ??
|
200
|
+
#
|
201
|
+
def assertConstNotDefined klass, konstant, message = nil
|
202
|
+
__reject (klass.const_defined? konstant), ASSERT_CONST_NOT_DEFINED_ERROR, message, {:klass=>klass, :konstant=>konstant}
|
203
|
+
end
|
204
|
+
|
205
|
+
private
|
206
|
+
##
|
207
|
+
# Helper for asserting descendents
|
208
|
+
def __assert_descendent error, klass, descendent, message
|
209
|
+
raise ArgumentError, "Expecting Class, got #{klass.class}" unless klass.is_a? Class
|
210
|
+
__assert_block error, message, {:class=>klass, :descendent=>descendent} do
|
211
|
+
yield
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require_relative 'Root'
|
2
|
+
|
3
|
+
module RubyUnit
|
4
|
+
module Assertions
|
5
|
+
module Collections
|
6
|
+
include RubyUnit::AssertionMessage
|
7
|
+
include Root
|
8
|
+
|
9
|
+
##
|
10
|
+
# Assert that a collection includes a specified value
|
11
|
+
# * raises RubyUnit::AssertionFailure unless _collection_ responds to _value_
|
12
|
+
#
|
13
|
+
# collection::
|
14
|
+
# The collection to check
|
15
|
+
#
|
16
|
+
# value::
|
17
|
+
# The value the object should contain
|
18
|
+
#
|
19
|
+
# message::
|
20
|
+
# The message provided to be reported for a failure
|
21
|
+
#
|
22
|
+
# assertInclude [1, 2], 'not in', 'It does not, so... no' # => fail
|
23
|
+
#
|
24
|
+
def assertInclude collection, value, message = nil
|
25
|
+
__assert_include ASSERT_INCLUDE_ERROR, collection, value, message do
|
26
|
+
collection.include? value
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
##
|
31
|
+
# Assert that a collection does not include a specified value
|
32
|
+
# * raises RubyUnit::AssertionFailure if _collection_ responds to _value_
|
33
|
+
#
|
34
|
+
# collection::
|
35
|
+
# The collection to check
|
36
|
+
#
|
37
|
+
# reject::
|
38
|
+
# The value the object should not contain
|
39
|
+
#
|
40
|
+
# message::
|
41
|
+
# The message provided to be reported for a failure
|
42
|
+
#
|
43
|
+
# assertNotInclude [1, 2, 3], 2, 'It does, so close' # => fail
|
44
|
+
#
|
45
|
+
def assertNotInclude collection, reject, message = nil
|
46
|
+
__assert_include ASSERT_NOT_INCLUDE_ERROR, collection, reject, message do
|
47
|
+
not collection.include? reject
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
##
|
52
|
+
# Assert that a value is empty
|
53
|
+
# * raises RubyUnit::AssertionFailure unless _object_ responds to :empty?
|
54
|
+
# * raises RubyUnit::AssertionFailure unless _object_ is empty
|
55
|
+
#
|
56
|
+
# object::
|
57
|
+
# The object to check
|
58
|
+
#
|
59
|
+
# message::
|
60
|
+
# The message provided to be reported for a failure
|
61
|
+
#
|
62
|
+
# assertEmpty [1, 2], 'Not empty' # => fail
|
63
|
+
#
|
64
|
+
def assertEmpty object, message = nil
|
65
|
+
__assert_empty ASSERT_EMPTY_ERROR, object, message do
|
66
|
+
object.empty?
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
##
|
71
|
+
# Assert that a value is not empty
|
72
|
+
# * raises RubyUnit::AssertionFailure unless _object_ responds to :empty?
|
73
|
+
# * raises RubyUnit::AssertionFailure if _object_ is empty
|
74
|
+
#
|
75
|
+
# object::
|
76
|
+
# The object to check
|
77
|
+
#
|
78
|
+
# message::
|
79
|
+
# The message provided to be reported for a failure
|
80
|
+
#
|
81
|
+
# assertNotInclude [1, 2, 3], 2, 'It does, so close' # => fail
|
82
|
+
#
|
83
|
+
def assertNotEmpty object, message = nil
|
84
|
+
__assert_empty ASSERT_EMPTY_ERROR, object, message do
|
85
|
+
not object.empty?
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
private
|
90
|
+
##
|
91
|
+
# Perform include assertion via block
|
92
|
+
def __assert_include error, collection, value, message #:nodoc:
|
93
|
+
raise ArgumentError, "#{collection.class} does not respond to :include?" unless collection.respond_to? :include?
|
94
|
+
__assert_block error, message, {:collection=>collection, :value=>value} { yield }
|
95
|
+
end
|
96
|
+
|
97
|
+
##
|
98
|
+
# Perform empty assertion via block
|
99
|
+
def __assert_empty error, object, message #:nodoc:
|
100
|
+
raise ArgumentError, "#{object.class} does not respond to :empty?" unless collection.respond_to? :empty?
|
101
|
+
__assert_block error, message, {:object=>object} { yield }
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|