minitest 5.0.6 → 5.0.7
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 +12 -0
- data/README.txt +10 -0
- data/Rakefile +0 -28
- data/lib/minitest.rb +11 -4
- data/lib/minitest/expectations.rb +13 -0
- data/lib/minitest/pride_plugin.rb +1 -1
- data/lib/minitest/spec.rb +2 -1
- data/test/minitest/test_minitest_mock.rb +26 -1
- data/test/minitest/test_minitest_reporter.rb +46 -2
- data/test/minitest/test_minitest_unit.rb +20 -5
- metadata +9 -9
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
=== 5.0.7 / 2013-09-05
|
2
|
+
|
3
|
+
* 2 minor enhancements:
|
4
|
+
|
5
|
+
* Added clarification about the use of thread local variables in expectations. (jemc)
|
6
|
+
* Added extra message about skipped tests, if any. Disable globally with $MT_NO_SKIP_MSG.
|
7
|
+
|
8
|
+
* 2 bug fixes:
|
9
|
+
|
10
|
+
* Only require minitest, not minitest/autorun in pride_plugin. (judofyr)
|
11
|
+
* Require rubygems in load_plugins in case you're not using minitest/autorun.
|
12
|
+
|
1
13
|
=== 5.0.6 / 2013-06-28
|
2
14
|
|
3
15
|
* 3 minor enhancements:
|
data/README.txt
CHANGED
@@ -366,6 +366,16 @@ you want to extend your test using setup/teardown via a module, just
|
|
366
366
|
make sure you ALWAYS call super. before/after automatically call super
|
367
367
|
for you, so make sure you don't do it twice.
|
368
368
|
|
369
|
+
== Prominent Projects using Minitest:
|
370
|
+
|
371
|
+
* arel
|
372
|
+
* journey
|
373
|
+
* mime-types
|
374
|
+
* nokogiri
|
375
|
+
* rails (active_support et al)
|
376
|
+
* rake
|
377
|
+
* rdoc
|
378
|
+
|
369
379
|
== Known Extensions:
|
370
380
|
|
371
381
|
capybara_minitest_spec :: Bridge between Capybara RSpec matchers and MiniTest::Spec expectations (e.g. page.must_have_content("Title")).
|
data/Rakefile
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
|
3
|
-
$TESTING_MINIUNIT = true
|
4
|
-
|
5
3
|
require 'rubygems'
|
6
4
|
require 'hoe'
|
7
5
|
|
@@ -14,10 +12,6 @@ Hoe.spec 'minitest' do
|
|
14
12
|
self.testlib = :minitest
|
15
13
|
end
|
16
14
|
|
17
|
-
def loc dir
|
18
|
-
system "find #{dir} -name \\*.rb | xargs wc -l | tail -1"
|
19
|
-
end
|
20
|
-
|
21
15
|
desc "Find missing expectations"
|
22
16
|
task :specs do
|
23
17
|
$:.unshift "lib"
|
@@ -69,26 +63,4 @@ task :specs do
|
|
69
63
|
end
|
70
64
|
end
|
71
65
|
|
72
|
-
desc "stupid line count"
|
73
|
-
task :dickwag do
|
74
|
-
puts
|
75
|
-
puts "miniunit"
|
76
|
-
puts
|
77
|
-
print " lib loc"; loc "lib"
|
78
|
-
print " test loc"; loc "test"
|
79
|
-
print " totl loc"; loc "lib test"
|
80
|
-
print " flog = "; system "flog -s lib"
|
81
|
-
|
82
|
-
puts
|
83
|
-
puts "test/unit"
|
84
|
-
puts
|
85
|
-
Dir.chdir File.expand_path("~/Work/svn/ruby/ruby_1_8") do
|
86
|
-
print " lib loc"; loc "lib/test"
|
87
|
-
print " test loc"; loc "test/testunit"
|
88
|
-
print " totl loc"; loc "lib/test test/testunit"
|
89
|
-
print " flog = "; system "flog -s lib/test"
|
90
|
-
end
|
91
|
-
puts
|
92
|
-
end
|
93
|
-
|
94
66
|
# vim: syntax=Ruby
|
data/lib/minitest.rb
CHANGED
@@ -4,7 +4,7 @@ require "optparse"
|
|
4
4
|
# :include: README.txt
|
5
5
|
|
6
6
|
module Minitest
|
7
|
-
VERSION = "5.0.
|
7
|
+
VERSION = "5.0.7" # :nodoc:
|
8
8
|
|
9
9
|
@@installed_at_exit ||= false
|
10
10
|
@@after_run = []
|
@@ -70,6 +70,8 @@ module Minitest
|
|
70
70
|
|
71
71
|
seen = {}
|
72
72
|
|
73
|
+
require "rubygems" unless defined? Gem
|
74
|
+
|
73
75
|
Gem.find_files("minitest/*_plugin.rb").each do |plugin_path|
|
74
76
|
name = File.basename plugin_path, "_plugin.rb"
|
75
77
|
|
@@ -519,7 +521,7 @@ module Minitest
|
|
519
521
|
|
520
522
|
io.sync = self.old_sync
|
521
523
|
|
522
|
-
io.puts # finish the dots
|
524
|
+
io.puts unless options[:verbose] # finish the dots
|
523
525
|
io.puts
|
524
526
|
io.puts statistics
|
525
527
|
io.puts aggregated_results
|
@@ -541,8 +543,13 @@ module Minitest
|
|
541
543
|
end
|
542
544
|
|
543
545
|
def summary # :nodoc:
|
544
|
-
|
545
|
-
|
546
|
+
extra = ""
|
547
|
+
|
548
|
+
extra = "\n\nYou have skipped tests. Run with --verbose for details." if
|
549
|
+
results.any?(&:skipped?) unless options[:verbose] or ENV["MT_NO_SKIP_MSG"]
|
550
|
+
|
551
|
+
"%d runs, %d assertions, %d failures, %d errors, %d skips%s" %
|
552
|
+
[count, assertions, failures, errors, skips, extra]
|
546
553
|
end
|
547
554
|
end
|
548
555
|
|
@@ -1,5 +1,18 @@
|
|
1
1
|
##
|
2
2
|
# It's where you hide your "assertions".
|
3
|
+
#
|
4
|
+
# Please note, because of the way that expectations are implemented,
|
5
|
+
# all expectations (eg must_equal) are dependent upon a thread local
|
6
|
+
# variable +:current_spec+. If your specs rely on mixing threads into
|
7
|
+
# the specs themselves, you're better off using assertions. For
|
8
|
+
# example:
|
9
|
+
#
|
10
|
+
# it "should still work in threads" do
|
11
|
+
# my_threaded_thingy do
|
12
|
+
# (1+1).must_equal 2 # bad
|
13
|
+
# assert_equal 2, 1+1 # good
|
14
|
+
# end
|
15
|
+
# end
|
3
16
|
|
4
17
|
module Minitest::Expectations
|
5
18
|
##
|
data/lib/minitest/spec.rb
CHANGED
@@ -53,7 +53,8 @@ module Kernel # :nodoc:
|
|
53
53
|
#
|
54
54
|
# but do note that several items there are debatable or specific to
|
55
55
|
# rspec.
|
56
|
-
|
56
|
+
#
|
57
|
+
# For more information about expectations, see Minitest::Expectations.
|
57
58
|
|
58
59
|
def describe desc, additional_desc = nil, &block # :doc:
|
59
60
|
stack = Minitest::Spec.describe_stack
|
@@ -109,7 +109,7 @@ class TestMinitestMock < Minitest::Test
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def test_expectations_can_be_satisfied_via_public_send
|
112
|
-
skip if RUBY_VERSION < "1.9"
|
112
|
+
skip "Doesn't run on 1.8" if RUBY_VERSION < "1.9"
|
113
113
|
|
114
114
|
@mock.public_send :foo
|
115
115
|
@mock.public_send :meaning_of_life
|
@@ -309,6 +309,31 @@ class TestMinitestMock < Minitest::Test
|
|
309
309
|
|
310
310
|
assert_equal exp, e.message
|
311
311
|
end
|
312
|
+
|
313
|
+
def test_mock_called_via_send
|
314
|
+
mock = Minitest::Mock.new
|
315
|
+
mock.expect(:foo, true)
|
316
|
+
|
317
|
+
mock.send :foo
|
318
|
+
mock.verify
|
319
|
+
end
|
320
|
+
|
321
|
+
def test_mock_called_via___send__
|
322
|
+
mock = Minitest::Mock.new
|
323
|
+
mock.expect(:foo, true)
|
324
|
+
|
325
|
+
mock.__send__ :foo
|
326
|
+
mock.verify
|
327
|
+
end
|
328
|
+
|
329
|
+
def test_mock_called_via_send_with_args
|
330
|
+
mock = Minitest::Mock.new
|
331
|
+
mock.expect(:foo, true, [1,2,3])
|
332
|
+
|
333
|
+
mock.send(:foo, 1, 2, 3)
|
334
|
+
mock.verify
|
335
|
+
end
|
336
|
+
|
312
337
|
end
|
313
338
|
|
314
339
|
require "minitest/metametameta"
|
@@ -65,7 +65,11 @@ class TestMinitestReporter < Minitest::Test
|
|
65
65
|
def skip_test
|
66
66
|
unless defined? @st then
|
67
67
|
@st = Minitest::Test.new(:woot)
|
68
|
-
@st.failures <<
|
68
|
+
@st.failures << begin
|
69
|
+
raise Minitest::Skip
|
70
|
+
rescue Minitest::Assertion => e
|
71
|
+
e
|
72
|
+
end
|
69
73
|
end
|
70
74
|
@st
|
71
75
|
end
|
@@ -80,16 +84,41 @@ class TestMinitestReporter < Minitest::Test
|
|
80
84
|
refute r.passed?
|
81
85
|
end
|
82
86
|
|
87
|
+
SKIP_MSG = "\n\nYou have skipped tests. Run with --verbose for details."
|
88
|
+
|
83
89
|
def test_passed_eh_error
|
90
|
+
r.start
|
91
|
+
|
84
92
|
r.results << error_test
|
85
93
|
|
86
94
|
refute r.passed?
|
95
|
+
|
96
|
+
r.report
|
97
|
+
|
98
|
+
refute_match SKIP_MSG, io.string
|
87
99
|
end
|
88
100
|
|
89
101
|
def test_passed_eh_skipped
|
102
|
+
r.start
|
90
103
|
r.results << skip_test
|
104
|
+
assert r.passed?
|
105
|
+
|
106
|
+
restore_env do
|
107
|
+
r.report
|
108
|
+
end
|
109
|
+
|
110
|
+
assert_match SKIP_MSG, io.string
|
111
|
+
end
|
91
112
|
|
113
|
+
def test_passed_eh_skipped_verbose
|
114
|
+
r.first.options[:verbose] = true
|
115
|
+
|
116
|
+
r.start
|
117
|
+
r.results << skip_test
|
92
118
|
assert r.passed?
|
119
|
+
r.report
|
120
|
+
|
121
|
+
refute_match SKIP_MSG, io.string
|
93
122
|
end
|
94
123
|
|
95
124
|
def test_start
|
@@ -247,10 +276,23 @@ class TestMinitestReporter < Minitest::Test
|
|
247
276
|
assert_equal exp, normalize_output(io.string)
|
248
277
|
end
|
249
278
|
|
279
|
+
def restore_env
|
280
|
+
old_value = ENV["MT_NO_SKIP_MSG"]
|
281
|
+
ENV.delete "MT_NO_SKIP_MSG"
|
282
|
+
|
283
|
+
yield
|
284
|
+
ensure
|
285
|
+
ENV["MT_NO_SKIP_MSG"] = old_value
|
286
|
+
end
|
287
|
+
|
288
|
+
|
250
289
|
def test_report_skipped
|
251
290
|
r.start
|
252
291
|
r.record skip_test
|
253
|
-
|
292
|
+
|
293
|
+
restore_env do
|
294
|
+
r.report
|
295
|
+
end
|
254
296
|
|
255
297
|
exp = clean <<-EOM
|
256
298
|
Run options:
|
@@ -262,6 +304,8 @@ class TestMinitestReporter < Minitest::Test
|
|
262
304
|
Finished in 0.00
|
263
305
|
|
264
306
|
1 runs, 0 assertions, 0 failures, 0 errors, 1 skips
|
307
|
+
|
308
|
+
You have skipped tests. Run with --verbose for details.
|
265
309
|
EOM
|
266
310
|
|
267
311
|
assert_equal exp, normalize_output(io.string)
|
@@ -368,6 +368,15 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
368
368
|
assert_report expected
|
369
369
|
end
|
370
370
|
|
371
|
+
def restore_env
|
372
|
+
old_value = ENV["MT_NO_SKIP_MSG"]
|
373
|
+
ENV.delete "MT_NO_SKIP_MSG"
|
374
|
+
|
375
|
+
yield
|
376
|
+
ensure
|
377
|
+
ENV["MT_NO_SKIP_MSG"] = old_value
|
378
|
+
end
|
379
|
+
|
371
380
|
def test_run_skip
|
372
381
|
@tu =
|
373
382
|
Class.new Minitest::Test do
|
@@ -386,9 +395,13 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
386
395
|
Finished in 0.00
|
387
396
|
|
388
397
|
2 runs, 1 assertions, 0 failures, 0 errors, 1 skips
|
398
|
+
|
399
|
+
You have skipped tests. Run with --verbose for details.
|
389
400
|
EOM
|
390
401
|
|
391
|
-
|
402
|
+
restore_env do
|
403
|
+
assert_report expected
|
404
|
+
end
|
392
405
|
end
|
393
406
|
|
394
407
|
def test_run_skip_verbose
|
@@ -407,7 +420,6 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
407
420
|
#<Class:0xXXX>#test_skip = 0.00 s = S
|
408
421
|
#<Class:0xXXX>#test_something = 0.00 s = .
|
409
422
|
|
410
|
-
|
411
423
|
Finished in 0.00
|
412
424
|
|
413
425
|
1) Skipped:
|
@@ -702,8 +714,8 @@ class TestMinitestUnitTestCase < Minitest::Test
|
|
702
714
|
end
|
703
715
|
|
704
716
|
def teardown
|
705
|
-
|
706
|
-
|
717
|
+
assert_equal(@assertion_count, @tc.assertions,
|
718
|
+
"expected #{@assertion_count} assertions to be fired during the test, not #{@tc.assertions}") if @tc.passed?
|
707
719
|
end
|
708
720
|
|
709
721
|
def non_verbose
|
@@ -891,6 +903,8 @@ class TestMinitestUnitTestCase < Minitest::Test
|
|
891
903
|
end
|
892
904
|
|
893
905
|
def test_delta_consistency
|
906
|
+
@assertion_count = 2
|
907
|
+
|
894
908
|
@tc.assert_in_delta 0, 1, 1
|
895
909
|
|
896
910
|
util_assert_triggered "Expected |0 - 1| (1) to not be <= 1." do
|
@@ -923,6 +937,8 @@ class TestMinitestUnitTestCase < Minitest::Test
|
|
923
937
|
end
|
924
938
|
|
925
939
|
def test_epsilon_consistency
|
940
|
+
@assertion_count = 2
|
941
|
+
|
926
942
|
@tc.assert_in_epsilon 1.0, 1.001
|
927
943
|
|
928
944
|
msg = "Expected |1.0 - 1.001| (0.000999xxx) to not be <= 0.001."
|
@@ -1355,7 +1371,6 @@ class TestMinitestUnitTestCase < Minitest::Test
|
|
1355
1371
|
|
1356
1372
|
def test_capture_subprocess_io
|
1357
1373
|
@assertion_count = 0
|
1358
|
-
skip "Dunno why but the parallel run of this fails"
|
1359
1374
|
|
1360
1375
|
non_verbose do
|
1361
1376
|
out, err = capture_subprocess_io do
|
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: 57
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 5
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 5.0.
|
9
|
+
- 7
|
10
|
+
version: 5.0.7
|
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-
|
39
|
+
date: 2013-09-05 00:00:00 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rdoc
|
@@ -61,11 +61,11 @@ dependencies:
|
|
61
61
|
requirements:
|
62
62
|
- - ~>
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
hash:
|
64
|
+
hash: 9
|
65
65
|
segments:
|
66
66
|
- 3
|
67
|
-
-
|
68
|
-
version: "3.
|
67
|
+
- 7
|
68
|
+
version: "3.7"
|
69
69
|
type: :development
|
70
70
|
version_requirements: *id002
|
71
71
|
description: |-
|
@@ -161,8 +161,8 @@ files:
|
|
161
161
|
- test/minitest/test_minitest_unit.rb
|
162
162
|
- .gemtest
|
163
163
|
homepage: https://github.com/seattlerb/minitest
|
164
|
-
licenses:
|
165
|
-
|
164
|
+
licenses:
|
165
|
+
- MIT
|
166
166
|
post_install_message:
|
167
167
|
rdoc_options:
|
168
168
|
- --main
|
metadata.gz.sig
CHANGED
Binary file
|