minitest 2.12.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/.autotest +1 -0
- data/History.txt +18 -0
- data/Manifest.txt +5 -5
- data/README.txt +16 -3
- data/lib/minitest/mock.rb +64 -12
- data/lib/minitest/unit.rb +18 -18
- data/test/{metametameta.rb → minitest/metametameta.rb} +9 -2
- data/test/{test_minitest_benchmark.rb → minitest/test_minitest_benchmark.rb} +0 -0
- data/test/{test_minitest_mock.rb → minitest/test_minitest_mock.rb} +89 -20
- data/test/{test_minitest_spec.rb → minitest/test_minitest_spec.rb} +0 -0
- data/test/{test_minitest_unit.rb → minitest/test_minitest_unit.rb} +17 -5
- metadata +17 -17
- metadata.gz.sig +3 -2
data.tar.gz.sig
CHANGED
Binary file
|
data/.autotest
CHANGED
@@ -10,6 +10,7 @@ Autotest.add_hook :initialize do |at|
|
|
10
10
|
at.extra_class_map["TestMeta"] = "test/test_minitest_spec.rb"
|
11
11
|
at.extra_class_map["TestMiniTestUnitTestCase"] = "test/test_minitest_unit.rb"
|
12
12
|
at.extra_class_map["TestMiniTestUnit"] = "test/test_minitest_unit.rb"
|
13
|
+
at.extra_class_map["TestMiniTestStub"] = "test/test_minitest_mock.rb"
|
13
14
|
at.add_exception 'coverage.info'
|
14
15
|
at.add_exception 'coverage'
|
15
16
|
end
|
data/History.txt
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
=== 3.0.0 / 2012-05-08
|
2
|
+
|
3
|
+
* 3 major enhancements:
|
4
|
+
|
5
|
+
* Added Object#stub (in minitest/mock.rb).
|
6
|
+
* Mock#expect mocks are used in the order they're given.
|
7
|
+
* Mock#verify now strictly compares against expect calls.
|
8
|
+
|
9
|
+
* 3 minor enhancements:
|
10
|
+
|
11
|
+
* Added caller to deprecation message.
|
12
|
+
* Mock error messages are much prettier.
|
13
|
+
* Removed String check for RHS of assert/refute_match. This lets #to_str work properly.
|
14
|
+
|
15
|
+
* 1 bug fix:
|
16
|
+
|
17
|
+
* Support drive letter on Windows. Patch provided from MRI by Usaku NAKAMURA. (ayumin)
|
18
|
+
|
1
19
|
=== 2.12.1 / 2012-04-10
|
2
20
|
|
3
21
|
* 1 minor enhancement:
|
data/Manifest.txt
CHANGED
@@ -11,8 +11,8 @@ lib/minitest/mock.rb
|
|
11
11
|
lib/minitest/pride.rb
|
12
12
|
lib/minitest/spec.rb
|
13
13
|
lib/minitest/unit.rb
|
14
|
-
test/metametameta.rb
|
15
|
-
test/test_minitest_benchmark.rb
|
16
|
-
test/test_minitest_mock.rb
|
17
|
-
test/test_minitest_spec.rb
|
18
|
-
test/test_minitest_unit.rb
|
14
|
+
test/minitest/metametameta.rb
|
15
|
+
test/minitest/test_minitest_benchmark.rb
|
16
|
+
test/minitest/test_minitest_mock.rb
|
17
|
+
test/minitest/test_minitest_spec.rb
|
18
|
+
test/minitest/test_minitest_unit.rb
|
data/README.txt
CHANGED
@@ -33,8 +33,8 @@ algorithms in a repeatable manner. Now you can assert that your newb
|
|
33
33
|
co-worker doesn't replace your linear algorithm with an exponential
|
34
34
|
one!
|
35
35
|
|
36
|
-
minitest/mock by Steven Baker, is a beautifully tiny mock
|
37
|
-
framework.
|
36
|
+
minitest/mock by Steven Baker, is a beautifully tiny mock (and stub)
|
37
|
+
object framework.
|
38
38
|
|
39
39
|
minitest/pride shows pride in testing and adds coloring to your test
|
40
40
|
output. I guess it is an example of how to write IO pipes too. :P
|
@@ -54,7 +54,7 @@ discovery.
|
|
54
54
|
* minitest/autorun - the easy and explicit way to run all your tests.
|
55
55
|
* minitest/unit - a very fast, simple, and clean test system.
|
56
56
|
* minitest/spec - a very fast, simple, and clean spec system.
|
57
|
-
* minitest/mock - a simple and clean mock system.
|
57
|
+
* minitest/mock - a simple and clean mock/stub system.
|
58
58
|
* minitest/benchmark - an awesome way to assert your algorithm's performance.
|
59
59
|
* minitest/pride - show your pride in testing!
|
60
60
|
* Incredibly small and fast runner, but no bells and whistles.
|
@@ -194,6 +194,18 @@ Output is tab-delimited to make it easy to paste into a spreadsheet.
|
|
194
194
|
end
|
195
195
|
end
|
196
196
|
|
197
|
+
=== Stubs
|
198
|
+
|
199
|
+
def test_stale_eh
|
200
|
+
obj_under_test = Something.new
|
201
|
+
|
202
|
+
refute obj_under_test.stale?
|
203
|
+
|
204
|
+
Time.stub :now, Time.at(0) do # stub goes away once the block is done
|
205
|
+
assert obj_under_test.stale?
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
197
209
|
=== Customizable Test Runner Types:
|
198
210
|
|
199
211
|
MiniTest::Unit.runner=(runner) provides an easy way of creating custom
|
@@ -284,6 +296,7 @@ minitest-wscolor :: Yet another test colorizer.
|
|
284
296
|
minitest_owrapper :: Get tests results as a TestResult object.
|
285
297
|
minitest_should :: Shoulda style syntax for minitest test::unit.
|
286
298
|
minitest_tu_shim :: minitest_tu_shim bridges between test/unit and minitest.
|
299
|
+
mongoid-minitest :: MiniTest matchers for Mongoid.
|
287
300
|
|
288
301
|
== REQUIREMENTS:
|
289
302
|
|
data/lib/minitest/mock.rb
CHANGED
@@ -50,6 +50,15 @@ module MiniTest
|
|
50
50
|
self
|
51
51
|
end
|
52
52
|
|
53
|
+
def call name, data
|
54
|
+
case data
|
55
|
+
when Hash then
|
56
|
+
"#{name}(#{data[:args].inspect[1..-2]}) => #{data[:retval].inspect}"
|
57
|
+
else
|
58
|
+
data.map { |d| call name, d }.join ", "
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
53
62
|
##
|
54
63
|
# Verify that all methods were called as expected. Raises
|
55
64
|
# +MockExpectationError+ if the mock object was not called as
|
@@ -58,8 +67,8 @@ module MiniTest
|
|
58
67
|
def verify
|
59
68
|
@expected_calls.each do |name, calls|
|
60
69
|
calls.each do |expected|
|
61
|
-
msg1 = "expected #{name
|
62
|
-
msg2 = "#{msg1}, got #{@actual_calls[name]
|
70
|
+
msg1 = "expected #{call name, expected}"
|
71
|
+
msg2 = "#{msg1}, got [#{call name, @actual_calls[name]}]"
|
63
72
|
|
64
73
|
raise MockExpectationError, msg2 if
|
65
74
|
@actual_calls.has_key? name and
|
@@ -78,25 +87,30 @@ module MiniTest
|
|
78
87
|
[sym, @expected_calls.keys.sort_by(&:to_s)]
|
79
88
|
end
|
80
89
|
|
81
|
-
|
90
|
+
index = @actual_calls[sym].length
|
91
|
+
expected_call = @expected_calls[sym][index]
|
82
92
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
[sym, arg_sizes.join('/'), args.size]
|
93
|
+
unless expected_call then
|
94
|
+
raise MockExpectationError, "No more expects available for %p: %p" %
|
95
|
+
[sym, args]
|
87
96
|
end
|
88
97
|
|
89
|
-
|
90
|
-
|
98
|
+
expected_args, retval = expected_call[:args], expected_call[:retval]
|
99
|
+
|
100
|
+
if expected_args.size != args.size then
|
101
|
+
raise ArgumentError, "mocked method %p expects %d arguments, got %d" %
|
102
|
+
[sym, expected_args.size, args.size]
|
91
103
|
end
|
92
104
|
|
93
|
-
|
105
|
+
fully_matched = expected_args.zip(args).all? { |mod, a|
|
106
|
+
mod === a or mod == a
|
107
|
+
}
|
108
|
+
|
109
|
+
unless fully_matched then
|
94
110
|
raise MockExpectationError, "mocked method %p called with unexpected arguments %p" %
|
95
111
|
[sym, args]
|
96
112
|
end
|
97
113
|
|
98
|
-
expected_args, retval = expected_call[:args], expected_call[:retval]
|
99
|
-
|
100
114
|
@actual_calls[sym] << {
|
101
115
|
:retval => retval,
|
102
116
|
:args => expected_args.zip(args).map { |mod, a| mod === a ? mod : a }
|
@@ -111,3 +125,41 @@ module MiniTest
|
|
111
125
|
end
|
112
126
|
end
|
113
127
|
end
|
128
|
+
|
129
|
+
class Object # :nodoc:
|
130
|
+
|
131
|
+
##
|
132
|
+
# Add a temporary stubbed method replacing +name+ for the duration
|
133
|
+
# of the +block+. If +val_or_callable+ responds to #call, then it
|
134
|
+
# returns the result of calling it, otherwise returns the value
|
135
|
+
# as-is. Cleans up the stub at the end of the +block+.
|
136
|
+
#
|
137
|
+
# def test_stale_eh
|
138
|
+
# obj_under_test = Something.new
|
139
|
+
# refute obj_under_test.stale?
|
140
|
+
#
|
141
|
+
# Time.stub :now, Time.at(0) do
|
142
|
+
# assert obj_under_test.stale?
|
143
|
+
# end
|
144
|
+
# end
|
145
|
+
|
146
|
+
def stub name, val_or_callable, &block
|
147
|
+
new_name = "__minitest_stub__#{name}"
|
148
|
+
|
149
|
+
metaclass = class << self; self; end
|
150
|
+
metaclass.send :alias_method, new_name, name
|
151
|
+
metaclass.send :define_method, name do |*args|
|
152
|
+
if val_or_callable.respond_to? :call then
|
153
|
+
val_or_callable.call(*args)
|
154
|
+
else
|
155
|
+
val_or_callable
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
yield
|
160
|
+
ensure
|
161
|
+
metaclass.send :undef_method, name
|
162
|
+
metaclass.send :alias_method, name, new_name
|
163
|
+
metaclass.send :undef_method, new_name
|
164
|
+
end
|
165
|
+
end
|
data/lib/minitest/unit.rb
CHANGED
@@ -186,7 +186,7 @@ module MiniTest
|
|
186
186
|
# Fails unless the block returns a true value.
|
187
187
|
|
188
188
|
def assert_block msg = nil
|
189
|
-
warn "NOTE: MiniTest::Unit::TestCase#assert_block is deprecated, use assert. It will be removed on or after 2012-06-01."
|
189
|
+
warn "NOTE: MiniTest::Unit::TestCase#assert_block is deprecated, use assert. It will be removed on or after 2012-06-01. Called from #{caller.first}"
|
190
190
|
msg = message(msg) { "Expected block to return true value" }
|
191
191
|
assert yield, msg
|
192
192
|
end
|
@@ -270,13 +270,13 @@ module MiniTest
|
|
270
270
|
end
|
271
271
|
|
272
272
|
##
|
273
|
-
# Fails unless +
|
273
|
+
# Fails unless +matcher+ <tt>=~</tt> +obj+.
|
274
274
|
|
275
|
-
def assert_match
|
276
|
-
msg = message(msg) { "Expected #{mu_pp
|
277
|
-
assert_respond_to
|
278
|
-
|
279
|
-
assert
|
275
|
+
def assert_match matcher, obj, msg = nil
|
276
|
+
msg = message(msg) { "Expected #{mu_pp matcher} to match #{mu_pp obj}" }
|
277
|
+
assert_respond_to matcher, :"=~"
|
278
|
+
matcher = Regexp.new Regexp.escape matcher if String === matcher
|
279
|
+
assert matcher =~ obj, msg
|
280
280
|
end
|
281
281
|
|
282
282
|
##
|
@@ -521,7 +521,7 @@ module MiniTest
|
|
521
521
|
end
|
522
522
|
|
523
523
|
##
|
524
|
-
# For comparing Floats. Fails if +exp+ is within +delta+ of +act
|
524
|
+
# For comparing Floats. Fails if +exp+ is within +delta+ of +act+.
|
525
525
|
#
|
526
526
|
# refute_in_delta Math::PI, (22.0 / 7.0)
|
527
527
|
|
@@ -542,7 +542,7 @@ module MiniTest
|
|
542
542
|
end
|
543
543
|
|
544
544
|
##
|
545
|
-
# Fails if +collection+ includes +obj
|
545
|
+
# Fails if +collection+ includes +obj+.
|
546
546
|
|
547
547
|
def refute_includes collection, obj, msg = nil
|
548
548
|
msg = message(msg) {
|
@@ -553,7 +553,7 @@ module MiniTest
|
|
553
553
|
end
|
554
554
|
|
555
555
|
##
|
556
|
-
# Fails if +obj+ is an instance of +cls
|
556
|
+
# Fails if +obj+ is an instance of +cls+.
|
557
557
|
|
558
558
|
def refute_instance_of cls, obj, msg = nil
|
559
559
|
msg = message(msg) {
|
@@ -563,7 +563,7 @@ module MiniTest
|
|
563
563
|
end
|
564
564
|
|
565
565
|
##
|
566
|
-
# Fails if +obj+ is a kind of +cls
|
566
|
+
# Fails if +obj+ is a kind of +cls+.
|
567
567
|
|
568
568
|
def refute_kind_of cls, obj, msg = nil # TODO: merge with instance_of
|
569
569
|
msg = message(msg) { "Expected #{mu_pp(obj)} to not be a kind of #{cls}" }
|
@@ -571,13 +571,13 @@ module MiniTest
|
|
571
571
|
end
|
572
572
|
|
573
573
|
##
|
574
|
-
# Fails if +
|
574
|
+
# Fails if +matcher+ <tt>=~</tt> +obj+.
|
575
575
|
|
576
|
-
def refute_match
|
577
|
-
msg = message(msg) {
|
578
|
-
assert_respond_to
|
579
|
-
|
580
|
-
refute
|
576
|
+
def refute_match matcher, obj, msg = nil
|
577
|
+
msg = message(msg) {"Expected #{mu_pp matcher} to not match #{mu_pp obj}"}
|
578
|
+
assert_respond_to matcher, :"=~"
|
579
|
+
matcher = Regexp.new Regexp.escape matcher if String === matcher
|
580
|
+
refute matcher =~ obj, msg
|
581
581
|
end
|
582
582
|
|
583
583
|
##
|
@@ -645,7 +645,7 @@ module MiniTest
|
|
645
645
|
end
|
646
646
|
|
647
647
|
class Unit # :nodoc:
|
648
|
-
VERSION = "
|
648
|
+
VERSION = "3.0.0" # :nodoc:
|
649
649
|
|
650
650
|
attr_accessor :report, :failures, :errors, :skips # :nodoc:
|
651
651
|
attr_accessor :test_count, :assertion_count # :nodoc:
|
@@ -19,8 +19,15 @@ class MetaMetaMetaTestCase < MiniTest::Unit::TestCase
|
|
19
19
|
output = @output.string.dup
|
20
20
|
output.sub!(/Finished tests in .*/, "Finished tests in 0.00")
|
21
21
|
output.sub!(/Loaded suite .*/, 'Loaded suite blah')
|
22
|
-
|
23
|
-
|
22
|
+
|
23
|
+
if windows? then
|
24
|
+
output.gsub!(/\[(?:[A-Za-z]:)?[^\]:]+:\d+\]/, '[FILE:LINE]')
|
25
|
+
output.gsub!(/^(\s+)(?:[A-Za-z]:)?[^:]+:\d+:in/, '\1FILE:LINE:in')
|
26
|
+
else
|
27
|
+
output.gsub!(/\[[^\]:]+:\d+\]/, '[FILE:LINE]')
|
28
|
+
output.gsub!(/^(\s+)[^:]+:\d+:in/, '\1FILE:LINE:in')
|
29
|
+
end
|
30
|
+
|
24
31
|
assert_equal(expected, output)
|
25
32
|
end
|
26
33
|
|
File without changes
|
@@ -20,7 +20,7 @@ class TestMiniTestMock < MiniTest::Unit::TestCase
|
|
20
20
|
def test_blow_up_if_not_called
|
21
21
|
@mock.foo
|
22
22
|
|
23
|
-
util_verify_bad
|
23
|
+
util_verify_bad "expected meaning_of_life() => 42, got []"
|
24
24
|
end
|
25
25
|
|
26
26
|
def test_not_blow_up_if_everything_called
|
@@ -40,7 +40,7 @@ class TestMiniTestMock < MiniTest::Unit::TestCase
|
|
40
40
|
@mock.meaning_of_life
|
41
41
|
@mock.expect(:bar, true)
|
42
42
|
|
43
|
-
util_verify_bad
|
43
|
+
util_verify_bad "expected bar() => true, got []"
|
44
44
|
end
|
45
45
|
|
46
46
|
def test_blow_up_on_wrong_number_of_arguments
|
@@ -78,15 +78,20 @@ class TestMiniTestMock < MiniTest::Unit::TestCase
|
|
78
78
|
@mock.meaning_of_life
|
79
79
|
@mock.expect(:sum, 3, [1, 2])
|
80
80
|
|
81
|
-
assert_raises MockExpectationError do
|
81
|
+
e = assert_raises MockExpectationError do
|
82
82
|
@mock.sum(2, 4)
|
83
83
|
end
|
84
|
+
|
85
|
+
exp = "mocked method :sum called with unexpected arguments [2, 4]"
|
86
|
+
assert_equal exp, e.message
|
84
87
|
end
|
85
88
|
|
86
89
|
def test_expect_with_non_array_args
|
87
|
-
assert_raises ArgumentError do
|
90
|
+
e = assert_raises ArgumentError do
|
88
91
|
@mock.expect :blah, 3, false
|
89
92
|
end
|
93
|
+
|
94
|
+
assert_equal "args must be an array", e.message
|
90
95
|
end
|
91
96
|
|
92
97
|
def test_respond_appropriately
|
@@ -143,27 +148,26 @@ class TestMiniTestMock < MiniTest::Unit::TestCase
|
|
143
148
|
mock = MiniTest::Mock.new
|
144
149
|
mock.expect :strict_expectation, true, [2]
|
145
150
|
|
146
|
-
assert_raises MockExpectationError do
|
151
|
+
e = assert_raises MockExpectationError do
|
147
152
|
mock.strict_expectation 1
|
148
153
|
end
|
154
|
+
|
155
|
+
exp = "mocked method :strict_expectation called with unexpected arguments [1]"
|
156
|
+
assert_equal exp, e.message
|
149
157
|
end
|
150
158
|
|
151
|
-
def
|
159
|
+
def test_method_missing_empty
|
152
160
|
mock = MiniTest::Mock.new
|
153
|
-
mock.expect :capitalized, true, ["a"]
|
154
|
-
mock.expect :capitalized, true, ["b"]
|
155
161
|
|
156
|
-
mock.
|
162
|
+
mock.expect :a, nil
|
163
|
+
|
164
|
+
mock.a
|
157
165
|
|
158
166
|
e = assert_raises MockExpectationError do
|
159
|
-
mock.
|
167
|
+
mock.a
|
160
168
|
end
|
161
169
|
|
162
|
-
|
163
|
-
b = {:retval=>true, :args=>["b"]}
|
164
|
-
|
165
|
-
expected = "expected capitalized, #{a.inspect}, got [#{b.inspect}]"
|
166
|
-
assert_equal expected, e.message
|
170
|
+
assert_equal "No more expects available for :a: []", e.message
|
167
171
|
end
|
168
172
|
|
169
173
|
def test_same_method_expects_are_verified_when_all_called
|
@@ -182,14 +186,79 @@ class TestMiniTestMock < MiniTest::Unit::TestCase
|
|
182
186
|
mock.expect :foo, nil, [:bar]
|
183
187
|
mock.expect :foo, nil, [:baz]
|
184
188
|
|
185
|
-
mock.foo :
|
189
|
+
mock.foo :bar
|
190
|
+
|
191
|
+
e = assert_raises(MockExpectationError) { mock.verify }
|
186
192
|
|
187
|
-
|
193
|
+
exp = "expected foo(:baz) => nil, got [foo(:bar) => nil]"
|
194
|
+
|
195
|
+
assert_equal exp, e.message
|
188
196
|
end
|
189
|
-
|
190
|
-
def util_verify_bad
|
191
|
-
assert_raises MockExpectationError do
|
197
|
+
|
198
|
+
def util_verify_bad exp
|
199
|
+
e = assert_raises MockExpectationError do
|
192
200
|
@mock.verify
|
193
201
|
end
|
202
|
+
|
203
|
+
assert_equal exp, e.message
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
require "test/minitest/metametameta"
|
208
|
+
|
209
|
+
class TestMiniTestStub < MiniTest::Unit::TestCase
|
210
|
+
def setup
|
211
|
+
super
|
212
|
+
MiniTest::Unit::TestCase.reset
|
213
|
+
|
214
|
+
@tc = MiniTest::Unit::TestCase.new 'fake tc'
|
215
|
+
@assertion_count = 1
|
216
|
+
end
|
217
|
+
|
218
|
+
def teardown
|
219
|
+
super
|
220
|
+
assert_equal @assertion_count, @tc._assertions
|
221
|
+
end
|
222
|
+
|
223
|
+
def assert_stub val_or_callable
|
224
|
+
@assertion_count += 1
|
225
|
+
|
226
|
+
t = Time.now.to_i
|
227
|
+
|
228
|
+
Time.stub :now, val_or_callable do
|
229
|
+
@tc.assert_equal 42, Time.now
|
230
|
+
end
|
231
|
+
|
232
|
+
@tc.assert_operator Time.now.to_i, :>=, t
|
233
|
+
end
|
234
|
+
|
235
|
+
def test_stub_value
|
236
|
+
assert_stub 42
|
237
|
+
end
|
238
|
+
|
239
|
+
def test_stub_block
|
240
|
+
assert_stub lambda { 42 }
|
241
|
+
end
|
242
|
+
|
243
|
+
def test_stub_block_args
|
244
|
+
@assertion_count += 1
|
245
|
+
|
246
|
+
t = Time.now.to_i
|
247
|
+
|
248
|
+
Time.stub :now, lambda { |n| n * 2 } do
|
249
|
+
@tc.assert_equal 42, Time.now(21)
|
250
|
+
end
|
251
|
+
|
252
|
+
@tc.assert_operator Time.now.to_i, :>=, t
|
253
|
+
end
|
254
|
+
|
255
|
+
def test_stub_callable
|
256
|
+
obj = Object.new
|
257
|
+
|
258
|
+
def obj.call
|
259
|
+
42
|
260
|
+
end
|
261
|
+
|
262
|
+
assert_stub obj
|
194
263
|
end
|
195
264
|
end
|
File without changes
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'pathname'
|
2
|
-
require 'test/metametameta'
|
2
|
+
require 'test/minitest/metametameta'
|
3
3
|
|
4
4
|
module MyModule; end
|
5
5
|
class AnError < StandardError; include MyModule; end
|
@@ -699,13 +699,16 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
|
|
699
699
|
|
700
700
|
def test_assert_block
|
701
701
|
exp = ["NOTE: MiniTest::Unit::TestCase#assert_block is deprecated,",
|
702
|
-
"use assert. It will be removed on or after 2012-06-01
|
702
|
+
"use assert. It will be removed on or after 2012-06-01."].join " "
|
703
703
|
|
704
|
-
|
704
|
+
out, err = capture_io do
|
705
705
|
@tc.assert_block do
|
706
706
|
true
|
707
707
|
end
|
708
708
|
end
|
709
|
+
|
710
|
+
assert_equal "", out
|
711
|
+
assert_match exp, err
|
709
712
|
end
|
710
713
|
|
711
714
|
def test_assert_block_triggered
|
@@ -927,7 +930,7 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
|
|
927
930
|
@tc.assert_match(/\w+/, "blah blah blah")
|
928
931
|
end
|
929
932
|
|
930
|
-
def
|
933
|
+
def test_assert_match_matcher_object
|
931
934
|
@assertion_count = 2
|
932
935
|
|
933
936
|
pattern = Object.new
|
@@ -936,6 +939,15 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
|
|
936
939
|
@tc.assert_match pattern, 5
|
937
940
|
end
|
938
941
|
|
942
|
+
def test_assert_match_matchee_to_str
|
943
|
+
@assertion_count = 2
|
944
|
+
|
945
|
+
obj = Object.new
|
946
|
+
def obj.to_str; "blah" end
|
947
|
+
|
948
|
+
@tc.assert_match "blah", obj
|
949
|
+
end
|
950
|
+
|
939
951
|
def test_assert_match_object_triggered
|
940
952
|
@assertion_count = 2
|
941
953
|
|
@@ -1454,7 +1466,7 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
|
|
1454
1466
|
@tc.refute_match(/\d+/, "blah blah blah")
|
1455
1467
|
end
|
1456
1468
|
|
1457
|
-
def
|
1469
|
+
def test_refute_match_matcher_object
|
1458
1470
|
@assertion_count = 2
|
1459
1471
|
@tc.refute_match Object.new, 5 # default #=~ returns false
|
1460
1472
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
|
-
-
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version:
|
7
|
+
- 3
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 3.0.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Davis
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
FBHgymkyj/AOSqKRIpXPhjC6
|
37
37
|
-----END CERTIFICATE-----
|
38
38
|
|
39
|
-
date: 2012-
|
39
|
+
date: 2012-05-09 00:00:00 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rdoc
|
@@ -96,8 +96,8 @@ description: |-
|
|
96
96
|
co-worker doesn't replace your linear algorithm with an exponential
|
97
97
|
one!
|
98
98
|
|
99
|
-
minitest/mock by Steven Baker, is a beautifully tiny mock
|
100
|
-
framework.
|
99
|
+
minitest/mock by Steven Baker, is a beautifully tiny mock (and stub)
|
100
|
+
object framework.
|
101
101
|
|
102
102
|
minitest/pride shows pride in testing and adds coloring to your test
|
103
103
|
output. I guess it is an example of how to write IO pipes too. :P
|
@@ -135,11 +135,11 @@ files:
|
|
135
135
|
- lib/minitest/pride.rb
|
136
136
|
- lib/minitest/spec.rb
|
137
137
|
- lib/minitest/unit.rb
|
138
|
-
- test/metametameta.rb
|
139
|
-
- test/test_minitest_benchmark.rb
|
140
|
-
- test/test_minitest_mock.rb
|
141
|
-
- test/test_minitest_spec.rb
|
142
|
-
- test/test_minitest_unit.rb
|
138
|
+
- test/minitest/metametameta.rb
|
139
|
+
- test/minitest/test_minitest_benchmark.rb
|
140
|
+
- test/minitest/test_minitest_mock.rb
|
141
|
+
- test/minitest/test_minitest_spec.rb
|
142
|
+
- test/minitest/test_minitest_unit.rb
|
143
143
|
- .gemtest
|
144
144
|
homepage: https://github.com/seattlerb/minitest
|
145
145
|
licenses: []
|
@@ -176,7 +176,7 @@ signing_key:
|
|
176
176
|
specification_version: 3
|
177
177
|
summary: minitest provides a complete suite of testing facilities supporting TDD, BDD, mocking, and benchmarking
|
178
178
|
test_files:
|
179
|
-
- test/test_minitest_benchmark.rb
|
180
|
-
- test/test_minitest_mock.rb
|
181
|
-
- test/test_minitest_spec.rb
|
182
|
-
- test/test_minitest_unit.rb
|
179
|
+
- test/minitest/test_minitest_benchmark.rb
|
180
|
+
- test/minitest/test_minitest_mock.rb
|
181
|
+
- test/minitest/test_minitest_spec.rb
|
182
|
+
- test/minitest/test_minitest_unit.rb
|
metadata.gz.sig
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
|
2
|
-
�
|
1
|
+
���ܘJ�E��$�3�l��#aTW�Hob�>� $MZ�3ڔ#?�2��J1��T�"Ҹ
|
2
|
+
�GaW:��6r��kס�F=��,�쏎�5��:��"�B� ��d�
|
3
|
+
i!a,`DӰ����']��I� x�K�:�j&(h���85P ��"�ⵡC���(�>x0)��Id�P �s���FG���*�<E�p�}r��}<��?3P�H9[LG
|