spec 5.0.19 → 5.3.3
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/History.txt +106 -0
- data/Manifest.txt +1 -1
- data/README.txt +83 -37
- data/Rakefile +3 -56
- data/lib/minitest.rb +58 -156
- data/lib/minitest/assertions.rb +13 -1
- data/lib/minitest/benchmark.rb +3 -3
- data/lib/minitest/hell.rb +1 -1
- data/lib/minitest/mock.rb +2 -2
- data/lib/minitest/parallel.rb +40 -0
- data/lib/minitest/pride_plugin.rb +1 -2
- data/lib/minitest/spec.rb +23 -22
- data/lib/minitest/test.rb +19 -8
- data/lib/spec.rb +156 -2
- data/readme.md +1 -1
- data/spec.gemspec +2 -2
- data/test/manual/simple.rb +10 -15
- data/test/minitest/metametameta.rb +4 -2
- data/test/minitest/test_minitest_benchmark.rb +7 -1
- data/test/minitest/test_minitest_mock.rb +12 -2
- data/test/minitest/test_minitest_reporter.rb +0 -1
- data/test/minitest/test_minitest_spec.rb +41 -4
- data/test/minitest/test_minitest_unit.rb +38 -20
- metadata +15 -37
- data/lib/minitest/parallel_each.rb +0 -120
- data/release_notes.md +0 -80
- data/test/manual/after_run.rb +0 -17
- data/test/manual/appium.rb +0 -14
- data/test/manual/appium_after_last.rb +0 -24
- data/test/manual/appium_before_first.rb +0 -23
- data/test/manual/assert.rb +0 -61
- data/test/manual/before_first_0.rb +0 -27
- data/test/manual/before_first_1.rb +0 -29
- data/test/manual/ctrl_c.rb +0 -11
- data/test/manual/debug.rb +0 -37
- data/test/manual/do_end.rb +0 -31
- data/test/manual/raise.rb +0 -61
- data/test/manual/run2.rb +0 -74
- data/test/manual/run3.rb +0 -91
- data/test/manual/setup.rb +0 -13
- data/test/manual/simple2.rb +0 -20
- data/test/manual/skip.rb +0 -15
- data/test/manual/t.rb +0 -11
- data/test/manual/trace.rb +0 -19
- data/test/manual/trace2.rb +0 -15
- data/test/minitest/test_helper.rb +0 -20
@@ -1,120 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# Provides a parallel #each that lets you enumerate using N threads.
|
3
|
-
# Use environment variable N to customize. Defaults to 2. Enumerable,
|
4
|
-
# so all the goodies come along (tho not all are wrapped yet to
|
5
|
-
# return another ParallelEach instance).
|
6
|
-
|
7
|
-
class Minitest::ParallelEach
|
8
|
-
require 'thread'
|
9
|
-
include Enumerable
|
10
|
-
|
11
|
-
##
|
12
|
-
# How many Threads to use for this parallel #each.
|
13
|
-
|
14
|
-
N = (ENV['N'] || 2).to_i
|
15
|
-
|
16
|
-
##
|
17
|
-
# Create a new ParallelEach instance over +list+.
|
18
|
-
|
19
|
-
def initialize list
|
20
|
-
@queue = Queue.new # *sigh*... the Queue api sucks sooo much...
|
21
|
-
|
22
|
-
list.each { |i| @queue << i }
|
23
|
-
N.times { @queue << nil }
|
24
|
-
end
|
25
|
-
|
26
|
-
def select(&block) # :nodoc:
|
27
|
-
self.class.new super
|
28
|
-
end
|
29
|
-
|
30
|
-
alias find_all select # :nodoc:
|
31
|
-
|
32
|
-
##
|
33
|
-
# Starts N threads that yield each element to your block. Joins the
|
34
|
-
# threads at the end.
|
35
|
-
|
36
|
-
def each
|
37
|
-
threads = N.times.map {
|
38
|
-
Thread.new do
|
39
|
-
Thread.current.abort_on_exception = true
|
40
|
-
while job = @queue.pop
|
41
|
-
yield job
|
42
|
-
end
|
43
|
-
end
|
44
|
-
}
|
45
|
-
threads.map(&:join)
|
46
|
-
end
|
47
|
-
|
48
|
-
def count # :nodoc:
|
49
|
-
[@queue.size - N, 0].max
|
50
|
-
end
|
51
|
-
|
52
|
-
alias_method :size, :count # :nodoc:
|
53
|
-
end
|
54
|
-
|
55
|
-
module Minitest
|
56
|
-
class << self
|
57
|
-
remove_method :__run
|
58
|
-
end
|
59
|
-
|
60
|
-
class Test
|
61
|
-
@mutex = Mutex.new
|
62
|
-
|
63
|
-
def self.synchronize # :nodoc:
|
64
|
-
if @mutex then # see parallel_each.rb
|
65
|
-
@mutex.synchronize { yield }
|
66
|
-
else
|
67
|
-
yield
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
alias :simple_capture_io :capture_io
|
72
|
-
|
73
|
-
def capture_io(&b)
|
74
|
-
Test.synchronize do
|
75
|
-
simple_capture_io(&b)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
alias :simple_capture_subprocess_io :capture_subprocess_io
|
80
|
-
|
81
|
-
def capture_subprocess_io(&b)
|
82
|
-
Test.synchronize do
|
83
|
-
simple_capture_subprocess_io(&b)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
class Reporter
|
89
|
-
@mutex = Mutex.new
|
90
|
-
|
91
|
-
def self.synchronize # :nodoc:
|
92
|
-
if @mutex then # see parallel_each.rb
|
93
|
-
@mutex.synchronize { yield }
|
94
|
-
else
|
95
|
-
yield
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
alias :simple_record :record
|
100
|
-
|
101
|
-
def record result
|
102
|
-
Reporter.synchronize do
|
103
|
-
simple_record result
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
##
|
109
|
-
# Runs all the +suites+ for a given +type+. Runs suites declaring
|
110
|
-
# a test_order of +:parallel+ in parallel, and everything else
|
111
|
-
# serial.
|
112
|
-
|
113
|
-
def self.__run reporter, options
|
114
|
-
suites = Runnable.runnables
|
115
|
-
parallel, serial = suites.partition { |s| s.test_order == :parallel }
|
116
|
-
|
117
|
-
ParallelEach.new(parallel).map { |suite| suite.run reporter, options } +
|
118
|
-
serial.map { |suite| suite.run reporter, options }
|
119
|
-
end
|
120
|
-
end
|
data/release_notes.md
DELETED
@@ -1,80 +0,0 @@
|
|
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
|
-
|
8
|
-
#### v5.0.17 2013-08-12
|
9
|
-
|
10
|
-
- [605696d](https://github.com/bootstraponline/spec/commit/605696d4952c9a8b9107e3a338c8713d6f979d18) Release 5.0.17
|
11
|
-
- [6665bda](https://github.com/bootstraponline/spec/commit/6665bdab8c57a3ec19849df9098593e36203cb46) Fix after_run
|
12
|
-
|
13
|
-
|
14
|
-
#### v5.0.16 2013-08-10
|
15
|
-
|
16
|
-
- [01269eb](https://github.com/bootstraponline/spec/commit/01269eb8f6e6209c5de9f55a0735ce23935d995a) Release 5.0.16
|
17
|
-
- [40504bb](https://github.com/bootstraponline/spec/commit/40504bbc92639baa24858a11f1ac931010980499) Print test name
|
18
|
-
|
19
|
-
|
20
|
-
#### v5.0.15 2013-08-07
|
21
|
-
|
22
|
-
- [c1f227c](https://github.com/bootstraponline/spec/commit/c1f227ca8f2803d2fe4da8caf7106f8cdda206e6) Release 5.0.15
|
23
|
-
- [df3f638](https://github.com/bootstraponline/spec/commit/df3f6387c4517962e53e577e980cbf9aed13eac9) Trace everytime run_specs is invoked
|
24
|
-
|
25
|
-
|
26
|
-
#### v5.0.14 2013-08-07
|
27
|
-
|
28
|
-
- [c5199e7](https://github.com/bootstraponline/spec/commit/c5199e7ae2578bb15a684210ba771d4db237121b) Release 5.0.14
|
29
|
-
- [6f52eed](https://github.com/bootstraponline/spec/commit/6f52eedbc2b6a2f963af31b8a9abc8be81b327e7) Fix trace
|
30
|
-
|
31
|
-
|
32
|
-
#### v5.0.13 2013-08-07
|
33
|
-
|
34
|
-
- [c401d7c](https://github.com/bootstraponline/spec/commit/c401d7cad546351f63ad62b17387643ce1b19b14) Release 5.0.13
|
35
|
-
- [f94221a](https://github.com/bootstraponline/spec/commit/f94221a3d3765c3884b76e320c479c901b39bcbb) Use set_trace_func instead of ruby2ruby
|
36
|
-
|
37
|
-
|
38
|
-
#### v5.0.12 2013-08-05
|
39
|
-
|
40
|
-
- [068adc4](https://github.com/bootstraponline/spec/commit/068adc41623e97981a5c80cf9c76bcb238b0dd46) Release 5.0.12
|
41
|
-
- [85460e5](https://github.com/bootstraponline/spec/commit/85460e58dbf95a9333771a3b508fc04c244ed057) Add method_source
|
42
|
-
|
43
|
-
|
44
|
-
#### v5.0.11 2013-08-05
|
45
|
-
|
46
|
-
- [2f64c6d](https://github.com/bootstraponline/spec/commit/2f64c6d65882f63f2cc2e19c83127bf8de957e5a) Release 5.0.11
|
47
|
-
- [7087a22](https://github.com/bootstraponline/spec/commit/7087a2254fc5644ea731852b2cbd9c384688c4d6) Fix comments
|
48
|
-
- [904c734](https://github.com/bootstraponline/spec/commit/904c734c6de78170e5128f24ab74a33f41407d45) Add more tests
|
49
|
-
- [c7a5948](https://github.com/bootstraponline/spec/commit/c7a5948169fb92fc11e8cc7afb2b0addd0bf60b3) All tests pass
|
50
|
-
- [6735b63](https://github.com/bootstraponline/spec/commit/6735b634467ba484085f8a26b815f65172a7c214) Fix after
|
51
|
-
- [3a578f4](https://github.com/bootstraponline/spec/commit/3a578f4eccead98793a437ca83e2bb66a9065c43) Start fixing rake test
|
52
|
-
- [9b04c73](https://github.com/bootstraponline/spec/commit/9b04c73410a5aeda35441078a7dfcea94ccabb9c) Don't print dots when running specs
|
53
|
-
- [e38252c](https://github.com/bootstraponline/spec/commit/e38252c587961d55b27d96d88e5b4aa32ece0d4e) t and it now print source
|
54
|
-
- [cb8063e](https://github.com/bootstraponline/spec/commit/cb8063e513d8be5a949366735130323a2b6cc67d) before_first, before, after, after_last now print source
|
55
|
-
- [0e370a7](https://github.com/bootstraponline/spec/commit/0e370a7181b94ed9f6eeb1e3c1557352501a9e8d) Fix before_first and after_last
|
56
|
-
- [9108c74](https://github.com/bootstraponline/spec/commit/9108c742f0fb061334a33eb29db3dade1b74e072) Add run specs
|
57
|
-
- [f2ea5f3](https://github.com/bootstraponline/spec/commit/f2ea5f387f3f92c8b1a9585bc560a1ed4041a57d) Fix raise
|
58
|
-
- [a41b7b5](https://github.com/bootstraponline/spec/commit/a41b7b5b170009dc5582c100ffa00ae99bf07bec) Fix gemspec
|
59
|
-
- [b35c3f9](https://github.com/bootstraponline/spec/commit/b35c3f9de6a8779ad575ad2c61bbfcb8ea7407c6) Fix reporting. More tests
|
60
|
-
- [ed620db](https://github.com/bootstraponline/spec/commit/ed620dbaaecf8e9aea18cfdc6c1db5c647b9aa51) Exit after first failure
|
61
|
-
- [0c359ef](https://github.com/bootstraponline/spec/commit/0c359efa663b4b6666c2e409faf57447db32ef4a) Start/report for full output
|
62
|
-
- [e78a157](https://github.com/bootstraponline/spec/commit/e78a157e23012ca2f26b7f1f20ab3761e511b434) Add before_first and after_last
|
63
|
-
- [17acf00](https://github.com/bootstraponline/spec/commit/17acf00114e32b2e45701a016212cd8eb558db18) Require minitest/spec by default
|
64
|
-
- [b7c66c8](https://github.com/bootstraponline/spec/commit/b7c66c839f7a520ea6eb9e22f54ecf493c7dab41) Fix test
|
65
|
-
|
66
|
-
|
67
|
-
#### v5.0.10 2013-07-29
|
68
|
-
|
69
|
-
- [8d6fe7d](https://github.com/bootstraponline/spec/commit/8d6fe7d724128ce263f2d4fc96bd40f293c3c8cb) Release 5.0.10
|
70
|
-
- [cb5f7b6](https://github.com/bootstraponline/spec/commit/cb5f7b69610c66281b6dc0a586048ce715d8288c) Enable require 'spec'
|
71
|
-
- [540ba98](https://github.com/bootstraponline/spec/commit/540ba98384e8945f6624a2726cc338e0378b67ff) Release 5.0.9
|
72
|
-
- [3be1349](https://github.com/bootstraponline/spec/commit/3be13498fc086f6b3fc4f342190383aba4992264) Release 5.0.9
|
73
|
-
|
74
|
-
|
75
|
-
#### v5.0.9 2013-07-29
|
76
|
-
|
77
|
-
- [3be1349](https://github.com/bootstraponline/spec/commit/3be13498fc086f6b3fc4f342190383aba4992264) Release 5.0.9
|
78
|
-
- [b09edff](https://github.com/bootstraponline/spec/commit/b09edff644cb25166177beb9c639a1817140d0b5) Add gem template
|
79
|
-
- [6c900a6](https://github.com/bootstraponline/spec/commit/6c900a69f6328238e5aeffcab1652bab20e0c699) Release 5.0.8
|
80
|
-
- [73e9f56](https://github.com/bootstraponline/spec/commit/73e9f5696e11d54e07bc3a8004ac0b62b5dd3616) Add gem template
|
data/test/manual/after_run.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'stringio' # stdlib
|
5
|
-
require 'spec' # not 'minitest'
|
6
|
-
|
7
|
-
describe 'a' do
|
8
|
-
t('b') { 1 }
|
9
|
-
t('c') { 2 }
|
10
|
-
end
|
11
|
-
|
12
|
-
Minitest.after_run do
|
13
|
-
$stdout.puts 'after run!'
|
14
|
-
end
|
15
|
-
|
16
|
-
# Run specs and trace this file
|
17
|
-
Minitest.run_specs({ :trace => [__FILE__] })
|
data/test/manual/appium.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'stringio' # stdlib
|
5
|
-
require 'spec' # not 'minitest'
|
6
|
-
|
7
|
-
describe 'a' do
|
8
|
-
after_last do
|
9
|
-
1.must_equal 2
|
10
|
-
end
|
11
|
-
t('') { puts 1 }
|
12
|
-
end
|
13
|
-
|
14
|
-
describe 'b' do
|
15
|
-
t('') { puts 2 }
|
16
|
-
end
|
17
|
-
|
18
|
-
# no dots
|
19
|
-
class Minitest::ProgressReporter
|
20
|
-
def record result
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
Minitest.run_specs
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'stringio' # stdlib
|
5
|
-
require 'spec' # not 'minitest'
|
6
|
-
|
7
|
-
describe 'a' do
|
8
|
-
before_first do
|
9
|
-
1.must_equal 2
|
10
|
-
end
|
11
|
-
t('') { puts 1 }
|
12
|
-
t('') { 2.must_equal 3 }
|
13
|
-
t('') { 4.must_equal 5 }
|
14
|
-
t('') { puts 4 }
|
15
|
-
end
|
16
|
-
|
17
|
-
# no dots
|
18
|
-
class Minitest::ProgressReporter
|
19
|
-
def record result
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
Minitest.run_specs
|
data/test/manual/assert.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'stringio' # stdlib
|
5
|
-
require 'spec' # not 'minitest'
|
6
|
-
|
7
|
-
class MiniTest::Spec
|
8
|
-
@@output = StringIO.new
|
9
|
-
|
10
|
-
def self.output
|
11
|
-
@@output
|
12
|
-
end
|
13
|
-
|
14
|
-
def p msg
|
15
|
-
@@output.puts msg
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
class SpecTest < MiniTest::Spec
|
20
|
-
describe 'a' do
|
21
|
-
t('') { p 1 }
|
22
|
-
t('') { 1.must_equal 2 }
|
23
|
-
t('') { p 3 }
|
24
|
-
t('') { p 4 }
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
options = {}
|
29
|
-
out = MiniTest::Spec.output
|
30
|
-
reporter = Minitest::CompositeReporter.new
|
31
|
-
reporter << Minitest::SummaryReporter.new(out, options)
|
32
|
-
reporter << Minitest::ProgressReporter.new(out, options)
|
33
|
-
|
34
|
-
reporter.start
|
35
|
-
|
36
|
-
begin
|
37
|
-
Minitest.__run reporter, options
|
38
|
-
reporter.reporters.each { |r| r.report }
|
39
|
-
rescue Minitest::Runnable::ExitAfterFirstFail
|
40
|
-
end
|
41
|
-
|
42
|
-
out.flush
|
43
|
-
out.rewind
|
44
|
-
|
45
|
-
actual = out.readlines.join ''
|
46
|
-
|
47
|
-
exp = <<'EXP'
|
48
|
-
1
|
49
|
-
.F
|
50
|
-
|
51
|
-
Finished in 0s
|
52
|
-
|
53
|
-
1) Failure:
|
54
|
-
a#test_0002_ [assert.rb:22]:
|
55
|
-
Expected: 2
|
56
|
-
Actual: 1
|
57
|
-
|
58
|
-
2 runs, 1 assertions, 1 failures, 0 errors, 0 skips
|
59
|
-
EXP
|
60
|
-
|
61
|
-
puts actual.must_equal exp
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'stringio' # stdlib
|
5
|
-
require 'spec' # not 'minitest'
|
6
|
-
|
7
|
-
describe 'a' do
|
8
|
-
before_first { '1' }
|
9
|
-
end
|
10
|
-
|
11
|
-
=begin
|
12
|
-
describe 'a' do
|
13
|
-
before_first { '1' }
|
14
|
-
before { '2' }
|
15
|
-
t('') { '3' }
|
16
|
-
after { '4' }
|
17
|
-
after_last { '5' }
|
18
|
-
end
|
19
|
-
=end
|
20
|
-
|
21
|
-
# no dots
|
22
|
-
class Minitest::ProgressReporter
|
23
|
-
def record result
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
Minitest.run_specs
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'stringio' # stdlib
|
5
|
-
require 'spec' # not 'minitest'
|
6
|
-
|
7
|
-
describe 'a' do
|
8
|
-
before_first do
|
9
|
-
'1'
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
=begin
|
14
|
-
describe 'a' do
|
15
|
-
before_first { '1' }
|
16
|
-
before { '2' }
|
17
|
-
t('') { '3' }
|
18
|
-
after { '4' }
|
19
|
-
after_last { '5' }
|
20
|
-
end
|
21
|
-
=end
|
22
|
-
|
23
|
-
# no dots
|
24
|
-
class Minitest::ProgressReporter
|
25
|
-
def record result
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
Minitest.run_specs
|
data/test/manual/ctrl_c.rb
DELETED
data/test/manual/debug.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# Source rewriting will cause problems with do/end blocks
|
2
|
-
# that expect a sane return value
|
3
|
-
|
4
|
-
@assertion_count = (@assertion_count + 3)
|
5
|
-
[1, 2, 3].must_include(2).must_equal(true)
|
6
|
-
|
7
|
-
assert_triggered("Expected [1, 2, 3] to include 5.") do
|
8
|
-
[1, 2, 3].must_include(5)
|
9
|
-
end
|
10
|
-
|
11
|
-
assert_triggered("msg.\nExpected [1, 2, 3] to include 5.") do
|
12
|
-
[1, 2, 3].must_include(5, "msg")
|
13
|
-
end
|
14
|
-
|
15
|
-
# --
|
16
|
-
|
17
|
-
|
18
|
-
puts %(@assertion_count = (@assertion_count + 3))
|
19
|
-
@assertion_count = (@assertion_count + 3)
|
20
|
-
|
21
|
-
puts %([1, 2, 3].must_include(2).must_equal(true))
|
22
|
-
[1, 2, 3].must_include(2).must_equal(true)
|
23
|
-
|
24
|
-
|
25
|
-
puts %(assert_triggered("Expected [1, 2, 3] to include 5.") do)
|
26
|
-
assert_triggered("Expected [1, 2, 3] to include 5.") do
|
27
|
-
puts %([1, 2, 3].must_include(5))
|
28
|
-
[1, 2, 3].must_include(5)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
puts %(end)
|
33
|
-
puts %(assert_triggered("msg.\\nExpected [1, 2, 3] to include 5.") do)
|
34
|
-
end
|
35
|
-
assert_triggered("msg.\nExpected [1, 2, 3] to include 5.") do
|
36
|
-
puts %([1, 2, 3].must_include(5, "msg"))
|
37
|
-
[1, 2, 3].must_include(5, "msg")
|