minitest 5.0.5 → 5.0.6
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.
- data.tar.gz.sig +0 -0
- data/History.txt +78 -66
- data/README.txt +1 -0
- data/lib/minitest.rb +1 -1
- data/lib/minitest/mock.rb +13 -5
- data/lib/minitest/test.rb +2 -0
- data/lib/minitest/unit.rb +6 -2
- data/test/minitest/test_minitest_mock.rb +16 -0
- metadata +4 -4
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
=== 5.0.6 / 2013-06-28
|
2
|
+
|
3
|
+
* 3 minor enhancements:
|
4
|
+
|
5
|
+
* Allow stub to pass args to blocks. (swindsor)
|
6
|
+
* Improved warning message about minitest/autorun to address 1.9's minitest/autorun.
|
7
|
+
* Made minitest/test require minitest as needed. For lib writers. (erikh)
|
8
|
+
|
9
|
+
* 1 bug fix:
|
10
|
+
|
11
|
+
* Fixed missing require in minitest/test. (erikh)
|
12
|
+
|
1
13
|
=== 5.0.5 / 2013-06-20
|
2
14
|
|
3
15
|
* 6 bug fixes:
|
@@ -49,72 +61,72 @@ Oh god... here we go...
|
|
49
61
|
|
50
62
|
Minitest 5:
|
51
63
|
|
52
|
-
|
53
|
-
|
54
|
-
* MiniTest.runner is dead. No more manager objects.
|
55
|
-
* MiniTest::Unit#record is dead. Use a Reporter instance instead.
|
56
|
-
* MiniTest::Unit._run_* is dead. Runnable things are responsible for their own runs.
|
57
|
-
* MiniTest::Unit.output is dead. No more centralized IO.
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
* Renamed MiniTest to Minitest. Your pinkies will thank me. (aliased to MiniTest)
|
62
|
-
* Removed MiniTest::Unit entirely. No more manager objects.
|
63
|
-
* Added Minitest::Runnable. Everything minitest can run subclasses this.
|
64
|
-
* Renamed MiniTest::Unit::TestCase to Minitest::Test (subclassing Runnable).
|
65
|
-
* Added Minitest::Benchmark.
|
66
|
-
|
67
|
-
|
68
|
-
* MiniTest::Unit.after_tests moved to Minitest.after_tests
|
69
|
-
* MiniTest::Unit.autorun is now Minitest.autorun. Just require minitest/autorun pls.
|
70
|
-
* Removed ParallelEach#grep since it isn't used anywhere.
|
71
|
-
* Renamed Runnable#__name__ to Runnable#name (but uses @NAME internally).
|
72
|
-
* Runnable#run needs to return self. Allows for swapping of results as needed.
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
* Moved Assertions module to minitest/assertions.rb
|
77
|
-
* Moved Expectations module to minitest/expectations.rb
|
78
|
-
* Moved Test to minitest/test.rb
|
79
|
-
* Moved everything else in minitest/unit.rb to minitest.rb
|
80
|
-
* minitest/unit.rb is now just a small (user-test only) compatibility layer.
|
81
|
-
* Moved most of minitest/pride into minitest/pride_plugin.
|
82
|
-
* minitest/pride now just activates pride.
|
83
|
-
* Moved ParallelEach under Minitest.
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
* Added a plugin system that can extend command-line options.
|
88
|
-
* Added Minitest.extensions.
|
89
|
-
* Added Minitest.reporter (only available during startup).
|
90
|
-
* Added Minitest.run(args). This is the very top of any Minitest run.
|
91
|
-
* Added Minitest::Reporter. Everything minitest can report goes through here.
|
92
|
-
|
93
|
-
* Added Minitest::CompositeReporter. Much easier to extend with your own reporters.
|
94
|
-
* Added UnexpectedError, an Assertion subclass, to wrap up errors.
|
95
|
-
* Minitest::Test#run is now freakin' beautiful. 47 -> 17 loc
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
* Removed Object.infect_with_assertions (it was already dead code).
|
100
|
-
* Runnables are responsible for knowing their result_code (eg "." or "F").
|
101
|
-
* Minitest.autorun now returns boolean, not exit code.
|
102
|
-
* Added FAQ entry for extending via modules. (phiggins)
|
103
|
-
* Implement Runnable#dup to cleanse state back to test results. Helps with serialization. pair:tenderlove
|
104
|
-
* Moved ParallelEach under Minitest.
|
105
|
-
* Runnable#run needs to return self. Allows for swapping of results as needed.
|
106
|
-
* Minitest.init_plugins passes down options.
|
107
|
-
* Minitest.load_plugins only loads once.
|
108
|
-
* Fixed minitest/pride to work with rake test loader again. (tmiller)
|
109
|
-
* Added count/size to ParallelEach to fix use w/in stdlib's test/unit. :( (btaitelb)
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
* Removed mutex from minitest.rb (phiggins)
|
114
|
-
* Removed mutex from test.rb (phiggins)
|
115
|
-
* Removed Minitest::Reporter.synchronize (phiggins)
|
116
|
-
* Removed Minitest::Test.synchronize (phiggins)
|
117
|
-
* Upon loading minitest/parallel_each, record, capture_io and capture_subprocess_io are doped with synchronization code. (phiggins)
|
64
|
+
* 4 deaths in the family:
|
65
|
+
|
66
|
+
* MiniTest.runner is dead. No more manager objects.
|
67
|
+
* MiniTest::Unit#record is dead. Use a Reporter instance instead.
|
68
|
+
* MiniTest::Unit._run_* is dead. Runnable things are responsible for their own runs.
|
69
|
+
* MiniTest::Unit.output is dead. No more centralized IO.
|
70
|
+
|
71
|
+
* 12 major (oft incompatible) changes:
|
72
|
+
|
73
|
+
* Renamed MiniTest to Minitest. Your pinkies will thank me. (aliased to MiniTest)
|
74
|
+
* Removed MiniTest::Unit entirely. No more manager objects.
|
75
|
+
* Added Minitest::Runnable. Everything minitest can run subclasses this.
|
76
|
+
* Renamed MiniTest::Unit::TestCase to Minitest::Test (subclassing Runnable).
|
77
|
+
* Added Minitest::Benchmark.
|
78
|
+
* Your benchmarks need to move to their own subclass.
|
79
|
+
* Benchmarks using the spec DSL have to have "Bench" somewhere in their describe.
|
80
|
+
* MiniTest::Unit.after_tests moved to Minitest.after_tests
|
81
|
+
* MiniTest::Unit.autorun is now Minitest.autorun. Just require minitest/autorun pls.
|
82
|
+
* Removed ParallelEach#grep since it isn't used anywhere.
|
83
|
+
* Renamed Runnable#__name__ to Runnable#name (but uses @NAME internally).
|
84
|
+
* Runnable#run needs to return self. Allows for swapping of results as needed.
|
85
|
+
|
86
|
+
* 8 minor moves:
|
87
|
+
|
88
|
+
* Moved Assertions module to minitest/assertions.rb
|
89
|
+
* Moved Expectations module to minitest/expectations.rb
|
90
|
+
* Moved Test to minitest/test.rb
|
91
|
+
* Moved everything else in minitest/unit.rb to minitest.rb
|
92
|
+
* minitest/unit.rb is now just a small (user-test only) compatibility layer.
|
93
|
+
* Moved most of minitest/pride into minitest/pride_plugin.
|
94
|
+
* minitest/pride now just activates pride.
|
95
|
+
* Moved ParallelEach under Minitest.
|
96
|
+
|
97
|
+
* 9 additions:
|
98
|
+
|
99
|
+
* Added a plugin system that can extend command-line options.
|
100
|
+
* Added Minitest.extensions.
|
101
|
+
* Added Minitest.reporter (only available during startup).
|
102
|
+
* Added Minitest.run(args). This is the very top of any Minitest run.
|
103
|
+
* Added Minitest::Reporter. Everything minitest can report goes through here.
|
104
|
+
* Minitest.reporter is a composite so you can add your own.
|
105
|
+
* Added Minitest::CompositeReporter. Much easier to extend with your own reporters.
|
106
|
+
* Added UnexpectedError, an Assertion subclass, to wrap up errors.
|
107
|
+
* Minitest::Test#run is now freakin' beautiful. 47 -> 17 loc
|
108
|
+
|
109
|
+
* 11 other:
|
110
|
+
|
111
|
+
* Removed Object.infect_with_assertions (it was already dead code).
|
112
|
+
* Runnables are responsible for knowing their result_code (eg "." or "F").
|
113
|
+
* Minitest.autorun now returns boolean, not exit code.
|
114
|
+
* Added FAQ entry for extending via modules. (phiggins)
|
115
|
+
* Implement Runnable#dup to cleanse state back to test results. Helps with serialization. pair:tenderlove
|
116
|
+
* Moved ParallelEach under Minitest.
|
117
|
+
* Runnable#run needs to return self. Allows for swapping of results as needed.
|
118
|
+
* Minitest.init_plugins passes down options.
|
119
|
+
* Minitest.load_plugins only loads once.
|
120
|
+
* Fixed minitest/pride to work with rake test loader again. (tmiller)
|
121
|
+
* Added count/size to ParallelEach to fix use w/in stdlib's test/unit. :( (btaitelb)
|
122
|
+
|
123
|
+
* 5 voodoo:
|
124
|
+
|
125
|
+
* Removed mutex from minitest.rb (phiggins)
|
126
|
+
* Removed mutex from test.rb (phiggins)
|
127
|
+
* Removed Minitest::Reporter.synchronize (phiggins)
|
128
|
+
* Removed Minitest::Test.synchronize (phiggins)
|
129
|
+
* Upon loading minitest/parallel_each, record, capture_io and capture_subprocess_io are doped with synchronization code. (phiggins)
|
118
130
|
|
119
131
|
=== 4.7.3 / 2013-04-20
|
120
132
|
|
data/README.txt
CHANGED
@@ -387,6 +387,7 @@ minitest-emoji :: Print out emoji for your test passes, fails, and
|
|
387
387
|
minitest-english :: Semantically symmetric aliases for assertions and expectations.
|
388
388
|
minitest-excludes :: Clean API for excluding certain tests you
|
389
389
|
don't want to run under certain conditions.
|
390
|
+
minitest-filesystem :: Adds assertion and expectation to help testing filesystem contents.
|
390
391
|
minitest-firemock :: Makes your MiniTest mocks more resilient.
|
391
392
|
minitest-great_expectations :: Generally useful additions to minitest's assertions and expectations
|
392
393
|
minitest-growl :: Test notifier for minitest via growl.
|
data/lib/minitest.rb
CHANGED
data/lib/minitest/mock.rb
CHANGED
@@ -170,8 +170,9 @@ class Object # :nodoc:
|
|
170
170
|
# Add a temporary stubbed method replacing +name+ for the duration
|
171
171
|
# of the +block+. If +val_or_callable+ responds to #call, then it
|
172
172
|
# returns the result of calling it, otherwise returns the value
|
173
|
-
# as-is.
|
174
|
-
#
|
173
|
+
# as-is. If stubbed method yields a block, +block_args+ will be
|
174
|
+
# passed along. Cleans up the stub at the end of the +block+. The
|
175
|
+
# method +name+ must exist before stubbing.
|
175
176
|
#
|
176
177
|
# def test_stale_eh
|
177
178
|
# obj_under_test = Something.new
|
@@ -181,8 +182,9 @@ class Object # :nodoc:
|
|
181
182
|
# assert obj_under_test.stale?
|
182
183
|
# end
|
183
184
|
# end
|
185
|
+
#
|
184
186
|
|
185
|
-
def stub name, val_or_callable, &block
|
187
|
+
def stub name, val_or_callable, *block_args, &block
|
186
188
|
new_name = "__minitest_stub__#{name}"
|
187
189
|
|
188
190
|
metaclass = class << self; self; end
|
@@ -195,12 +197,17 @@ class Object # :nodoc:
|
|
195
197
|
|
196
198
|
metaclass.send :alias_method, new_name, name
|
197
199
|
|
198
|
-
metaclass.send :define_method, name do |*args|
|
199
|
-
|
200
|
+
metaclass.send :define_method, name do |*args, &blk|
|
201
|
+
|
202
|
+
ret = if val_or_callable.respond_to? :call then
|
200
203
|
val_or_callable.call(*args)
|
201
204
|
else
|
202
205
|
val_or_callable
|
203
206
|
end
|
207
|
+
|
208
|
+
blk.call(*block_args) if blk
|
209
|
+
|
210
|
+
ret
|
204
211
|
end
|
205
212
|
|
206
213
|
yield self
|
@@ -209,4 +216,5 @@ class Object # :nodoc:
|
|
209
216
|
metaclass.send :alias_method, name, new_name
|
210
217
|
metaclass.send :undef_method, new_name
|
211
218
|
end
|
219
|
+
|
212
220
|
end
|
data/lib/minitest/test.rb
CHANGED
data/lib/minitest/unit.rb
CHANGED
@@ -4,8 +4,12 @@ unless defined?(Minitest) then
|
|
4
4
|
# all of this crap is just to avoid circular requires and is only
|
5
5
|
# needed if a user requires "minitest/unit" directly instead of
|
6
6
|
# "minitest/autorun", so we also warn
|
7
|
-
|
8
|
-
|
7
|
+
|
8
|
+
from = caller.reject { |s| s =~ /rubygems/ }.join("\n ")
|
9
|
+
warn "Warning: you should require 'minitest/autorun' instead."
|
10
|
+
warn %(Warning: or add 'gem "minitest"' before 'require "minitest/autorun"')
|
11
|
+
warn "From:\n #{from}"
|
12
|
+
|
9
13
|
module Minitest; end
|
10
14
|
MiniTest = Minitest # prevents minitest.rb from requiring back to us
|
11
15
|
require "minitest"
|
@@ -445,4 +445,20 @@ class TestMinitestStub < Minitest::Test
|
|
445
445
|
@tc.assert_equal true, val
|
446
446
|
@tc.assert_equal false, dynamic.found
|
447
447
|
end
|
448
|
+
|
449
|
+
def test_mock_with_yield
|
450
|
+
mock = Minitest::Mock.new
|
451
|
+
mock.expect(:write, true) do
|
452
|
+
true
|
453
|
+
end
|
454
|
+
rs = nil
|
455
|
+
|
456
|
+
File.stub(:open, true, mock) do
|
457
|
+
File.open("foo.txt", "r") do |f|
|
458
|
+
rs = f.write
|
459
|
+
end
|
460
|
+
end
|
461
|
+
@tc.assert_equal true, rs
|
462
|
+
end
|
463
|
+
|
448
464
|
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: 59
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 5
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 5.0.
|
9
|
+
- 6
|
10
|
+
version: 5.0.6
|
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: 2013-06-
|
39
|
+
date: 2013-06-28 00:00:00 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rdoc
|
metadata.gz.sig
CHANGED
Binary file
|