spec 5.0.18 → 5.0.19
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/lib/minitest.rb +16 -8
- data/lib/minitest/expectations.rb +13 -0
- data/lib/minitest/spec.rb +3 -2
- data/release_notes.md +7 -0
- data/test/manual/skip.rb +15 -0
- data/test/minitest/test_minitest_reporter.rb +46 -2
- data/test/minitest/test_minitest_unit.rb +3 -2
- 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: 5038d9de846696ce5a2f21796e96617307552236
|
4
|
+
data.tar.gz: ccc9abc1332c91214faa8d35e3c89cb22976ea55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7da9864a71d17f68ce58d957099918028d03b19a4bcc80961b4aa5397e14867db34c18f44a8a7ddb0dc5681f84b03b9547a0c59b49e98454cf58c9c7cafea731
|
7
|
+
data.tar.gz: 18330a6e213562aed882a7a31bec0d7b80607c3077375fa3fe62adf46d109debce732098ebe926d2fb843b7325116ac002009e210aa41412924c6adffc12ed90
|
data/lib/minitest.rb
CHANGED
@@ -5,8 +5,8 @@ require 'chronic_duration'
|
|
5
5
|
# :include: README.txt
|
6
6
|
|
7
7
|
module Minitest
|
8
|
-
VERSION = '5.0.
|
9
|
-
DATE = '2013-08-
|
8
|
+
VERSION = '5.0.19' # :nodoc:
|
9
|
+
DATE = '2013-08-19' # :nodoc:
|
10
10
|
|
11
11
|
@@installed_at_exit ||= false
|
12
12
|
@@after_run = []
|
@@ -148,8 +148,9 @@ module Minitest
|
|
148
148
|
io = spec_opts.fetch(:io, $stdout)
|
149
149
|
color = spec_opts.fetch(:color, "\e[32m") # ANSI.green default
|
150
150
|
# target only existing readable files
|
151
|
-
files_to_trace.each
|
152
|
-
|
151
|
+
files_to_trace.each do |f|
|
152
|
+
targets.push(File.expand_path(f)) if File.exists?(f) && File.readable?(f)
|
153
|
+
end
|
153
154
|
return if targets.empty?
|
154
155
|
|
155
156
|
set_trace_func(lambda do |event, file, line, id, binding, classname|
|
@@ -325,7 +326,9 @@ module Minitest
|
|
325
326
|
class ExitAfterFirstFail < RuntimeError; end
|
326
327
|
|
327
328
|
def self.check_failures result, reporter
|
328
|
-
|
329
|
+
# skip is not a failure.
|
330
|
+
true_fails = result.failures.reject { |obj| obj.class == Minitest::Skip }
|
331
|
+
if !true_fails.empty?
|
329
332
|
begin
|
330
333
|
reporter.reporters.each { |r| r.report }
|
331
334
|
ensure
|
@@ -651,7 +654,7 @@ module Minitest
|
|
651
654
|
|
652
655
|
io.sync = self.old_sync
|
653
656
|
|
654
|
-
io.puts # finish the dots
|
657
|
+
io.puts unless options[:verbose] # finish the dots
|
655
658
|
io.puts
|
656
659
|
io.puts statistics
|
657
660
|
io.puts aggregated_results
|
@@ -672,8 +675,13 @@ module Minitest
|
|
672
675
|
end
|
673
676
|
|
674
677
|
def summary # :nodoc:
|
675
|
-
|
676
|
-
|
678
|
+
extra = ""
|
679
|
+
|
680
|
+
extra = "\n\nYou have skipped tests. Run with --verbose for details." if
|
681
|
+
results.any?(&:skipped?) unless options[:verbose] or ENV["MT_NO_SKIP_MSG"]
|
682
|
+
|
683
|
+
"%d runs, %d assertions, %d failures, %d errors, %d skips%s" %
|
684
|
+
[count, assertions, failures, errors, skips, extra]
|
677
685
|
end
|
678
686
|
end
|
679
687
|
|
@@ -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
|
@@ -289,4 +290,4 @@ require "minitest/expectations"
|
|
289
290
|
|
290
291
|
class Object # :nodoc:
|
291
292
|
include Minitest::Expectations unless ENV["MT_NO_EXPECTATIONS"]
|
292
|
-
end
|
293
|
+
end
|
data/release_notes.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
#### v5.0.18 2013-08-13
|
2
|
+
|
3
|
+
- [60c70b0](https://github.com/bootstraponline/spec/commit/60c70b0ef6005a515086467c1af3a9faedfb4da3) Release 5.0.18
|
4
|
+
- [c0ebada](https://github.com/bootstraponline/spec/commit/c0ebada0543fb3d11ceb441cf17da91566119c41) Invoke after_run on Ctrl + C
|
5
|
+
- [630edb2](https://github.com/bootstraponline/spec/commit/630edb2b45f3948ca0d465f29e1c198050fe0fb5) Fix exit
|
6
|
+
|
7
|
+
|
1
8
|
#### v5.0.17 2013-08-12
|
2
9
|
|
3
10
|
- [605696d](https://github.com/bootstraponline/spec/commit/605696d4952c9a8b9107e3a338c8713d6f979d18) Release 5.0.17
|
data/test/manual/skip.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'stringio' # stdlib
|
5
|
+
require 'spec' # not 'minitest'
|
6
|
+
|
7
|
+
describe 'a' do
|
8
|
+
t('') { puts 1 }
|
9
|
+
t('') { skip }
|
10
|
+
t('') { puts 3 }
|
11
|
+
t('') { skip }
|
12
|
+
t('') { puts 5 }
|
13
|
+
end
|
14
|
+
|
15
|
+
Minitest.run_specs({ trace: [__FILE__], verbose: true })
|
@@ -66,7 +66,11 @@ class TestMinitestReporter < Minitest::Test
|
|
66
66
|
def skip_test
|
67
67
|
unless defined? @st then
|
68
68
|
@st = Minitest::Test.new(:woot)
|
69
|
-
@st.failures <<
|
69
|
+
@st.failures << begin
|
70
|
+
raise Minitest::Skip
|
71
|
+
rescue Minitest::Assertion => e
|
72
|
+
e
|
73
|
+
end
|
70
74
|
end
|
71
75
|
@st
|
72
76
|
end
|
@@ -81,16 +85,41 @@ class TestMinitestReporter < Minitest::Test
|
|
81
85
|
refute r.passed?
|
82
86
|
end
|
83
87
|
|
88
|
+
SKIP_MSG = "\n\nYou have skipped tests. Run with --verbose for details."
|
89
|
+
|
84
90
|
def test_passed_eh_error
|
91
|
+
r.start
|
92
|
+
|
85
93
|
r.results << error_test
|
86
94
|
|
87
95
|
refute r.passed?
|
96
|
+
|
97
|
+
r.report
|
98
|
+
|
99
|
+
refute_match SKIP_MSG, io.string
|
88
100
|
end
|
89
101
|
|
90
102
|
def test_passed_eh_skipped
|
103
|
+
r.start
|
91
104
|
r.results << skip_test
|
105
|
+
assert r.passed?
|
106
|
+
|
107
|
+
restore_env do
|
108
|
+
r.report
|
109
|
+
end
|
110
|
+
|
111
|
+
assert_match SKIP_MSG, io.string
|
112
|
+
end
|
92
113
|
|
114
|
+
def test_passed_eh_skipped_verbose
|
115
|
+
r.first.options[:verbose] = true
|
116
|
+
|
117
|
+
r.start
|
118
|
+
r.results << skip_test
|
93
119
|
assert r.passed?
|
120
|
+
r.report
|
121
|
+
|
122
|
+
refute_match SKIP_MSG, io.string
|
94
123
|
end
|
95
124
|
|
96
125
|
def test_start
|
@@ -248,10 +277,23 @@ class TestMinitestReporter < Minitest::Test
|
|
248
277
|
assert_equal exp, normalize_output(io.string)
|
249
278
|
end
|
250
279
|
|
280
|
+
def restore_env
|
281
|
+
old_value = ENV["MT_NO_SKIP_MSG"]
|
282
|
+
ENV.delete "MT_NO_SKIP_MSG"
|
283
|
+
|
284
|
+
yield
|
285
|
+
ensure
|
286
|
+
ENV["MT_NO_SKIP_MSG"] = old_value
|
287
|
+
end
|
288
|
+
|
289
|
+
|
251
290
|
def test_report_skipped
|
252
291
|
r.start
|
253
292
|
r.record skip_test
|
254
|
-
|
293
|
+
|
294
|
+
restore_env do
|
295
|
+
r.report
|
296
|
+
end
|
255
297
|
|
256
298
|
exp = clean <<-EOM
|
257
299
|
Run options:
|
@@ -263,6 +305,8 @@ class TestMinitestReporter < Minitest::Test
|
|
263
305
|
Finished in 0.00
|
264
306
|
|
265
307
|
1 runs, 0 assertions, 0 failures, 0 errors, 1 skips
|
308
|
+
|
309
|
+
You have skipped tests. Run with --verbose for details.
|
266
310
|
EOM
|
267
311
|
|
268
312
|
assert_equal exp, normalize_output(io.string)
|
@@ -387,6 +387,8 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
387
387
|
Finished in 0.00
|
388
388
|
|
389
389
|
2 runs, 1 assertions, 0 failures, 0 errors, 1 skips
|
390
|
+
|
391
|
+
You have skipped tests. Run with --verbose for details.
|
390
392
|
EOM
|
391
393
|
|
392
394
|
assert_report expected
|
@@ -408,7 +410,6 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
408
410
|
#<Class:0xXXX>#test_something = 0.00 s = .
|
409
411
|
#<Class:0xXXX>#test_skip = 0.00 s = S
|
410
412
|
|
411
|
-
|
412
413
|
Finished in 0.00
|
413
414
|
|
414
415
|
1) Skipped:
|
@@ -416,7 +417,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
416
417
|
not yet
|
417
418
|
|
418
419
|
2 runs, 1 assertions, 0 failures, 0 errors, 1 skips
|
419
|
-
|
420
|
+
EOM
|
420
421
|
|
421
422
|
assert_report expected, %w[--seed 42 --verbose]
|
422
423
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- code@bootstraponline.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chronic_duration
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- test/manual/setup.rb
|
104
104
|
- test/manual/simple.rb
|
105
105
|
- test/manual/simple2.rb
|
106
|
+
- test/manual/skip.rb
|
106
107
|
- test/manual/t.rb
|
107
108
|
- test/manual/trace.rb
|
108
109
|
- test/manual/trace2.rb
|