minitest-hooks 1.4.1 → 1.4.2
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/CHANGELOG +8 -0
- data/Rakefile +1 -3
- data/lib/minitest/hooks/test.rb +7 -7
- data/spec/all.rb +4 -0
- data/spec/errors/example.rb +8 -0
- data/spec/helper.rb +2 -0
- data/spec/minitest_hooks_all_name_spec.rb +25 -6
- data/spec/minitest_hooks_direct_spec.rb +1 -1
- data/spec/minitest_hooks_errors_spec.rb +1 -1
- data/spec/minitest_hooks_spec.rb +1 -1
- data/spec/minitest_hooks_test.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cab2b3cd7d0bc63cc18436e87e08ff392e9facfc
|
4
|
+
data.tar.gz: 82eed894ed6beab837d83fd94a64ab3c36e1acb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa12984df59acb3da5d4d038f2d5aa83b758724a5f7a2d258f6f82ddc5d23d7afc739eaaa9b09bdd72befa7f040f693a398ced29b3086e6ef9278118753975bb
|
7
|
+
data.tar.gz: b2e8f5f4bdf2e1283711cb2b947da5ea5526eaf7e00bd2ec0912011764203c16f7ba376011df4898a4bb8108599b6e416b447859838af44d7adf229f89d152ee
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
=== 1.4.2 (2017-09-12)
|
2
|
+
|
3
|
+
* Don't modify test instance name if before_all/after_all cause an error (jeremyevans) (#14)
|
4
|
+
|
5
|
+
* Set around_all test instance name to strings so that exceptions in {before,after,around}_all don't break reporters (jeremyevans) (#14)
|
6
|
+
|
7
|
+
* Set time to 0 for around_all test instance so that exceptions in {before,after,around}_all don't break reporters (jeremyevans) (#13, #14)
|
8
|
+
|
1
9
|
=== 1.4.1 (2017-07-31)
|
2
10
|
|
3
11
|
* Set test/spec name correctly when running before(:all)/after(:all)/around(:all) hooks (rcrogers, jeremyevans) (#12)
|
data/Rakefile
CHANGED
@@ -12,9 +12,7 @@ end
|
|
12
12
|
|
13
13
|
desc "Run specs"
|
14
14
|
task :spec do
|
15
|
-
|
16
|
-
ENV['RUBYLIB'] = "lib:#{ENV['RUBYLIB']}"
|
17
|
-
sh %{#{FileUtils::RUBY} -I lib -e 'ARGV.each{|f| require f}' ./spec/*.rb}
|
15
|
+
sh %{#{FileUtils::RUBY} spec/all.rb}
|
18
16
|
end
|
19
17
|
|
20
18
|
task :default=>:spec
|
data/lib/minitest/hooks/test.rb
CHANGED
@@ -49,7 +49,7 @@ module Minitest::Hooks::ClassMethods
|
|
49
49
|
# Unless name is NEW, return a dup singleton instance.
|
50
50
|
def new(name)
|
51
51
|
if name.equal?(NEW)
|
52
|
-
return super(
|
52
|
+
return super('around_all')
|
53
53
|
end
|
54
54
|
|
55
55
|
instance = @instance.dup
|
@@ -63,14 +63,15 @@ module Minitest::Hooks::ClassMethods
|
|
63
63
|
# dup of the singleton instance.
|
64
64
|
def with_info_handler(reporter, &block)
|
65
65
|
@instance = new(NEW)
|
66
|
-
|
66
|
+
@instance.time = 0
|
67
|
+
description = respond_to?(:desc) ? desc : name
|
68
|
+
@instance.name = "#{description}#around_all"
|
67
69
|
|
68
70
|
begin
|
69
71
|
@instance.around_all do
|
70
|
-
inside = true
|
71
72
|
begin
|
72
73
|
@instance.capture_exceptions do
|
73
|
-
@instance.name =
|
74
|
+
@instance.name = "#{description}#before_all"
|
74
75
|
@instance.before_all
|
75
76
|
end
|
76
77
|
|
@@ -82,15 +83,14 @@ module Minitest::Hooks::ClassMethods
|
|
82
83
|
end
|
83
84
|
ensure
|
84
85
|
@instance.capture_exceptions do
|
85
|
-
@instance.name =
|
86
|
+
@instance.name = "#{description}#after_all" unless failed
|
86
87
|
@instance.after_all
|
87
88
|
end
|
88
89
|
if @instance.failure && !failed
|
89
90
|
failed = true
|
90
91
|
reporter.record @instance
|
91
92
|
end
|
92
|
-
@instance.name =
|
93
|
-
inside = false
|
93
|
+
@instance.name = "#{description}#around_all" unless failed
|
94
94
|
end
|
95
95
|
end
|
96
96
|
rescue => e
|
data/spec/all.rb
ADDED
data/spec/errors/example.rb
CHANGED
@@ -24,6 +24,14 @@ describe 'Minitest::Hooks error handling' do
|
|
24
24
|
around(:all) do |&block|
|
25
25
|
raise if error == 'around-all-before'
|
26
26
|
super(&block)
|
27
|
+
case error
|
28
|
+
when 'before-all'
|
29
|
+
name.must_equal 'Minitest::Hooks error handling#before_all'
|
30
|
+
when 'after-all'
|
31
|
+
name.must_equal 'Minitest::Hooks error handling#after_all'
|
32
|
+
else
|
33
|
+
name.must_equal 'Minitest::Hooks error handling#around_all'
|
34
|
+
end
|
27
35
|
raise if error == 'around-all-after'
|
28
36
|
end
|
29
37
|
|
data/spec/helper.rb
CHANGED
@@ -3,17 +3,15 @@ require 'minitest/hooks/default'
|
|
3
3
|
|
4
4
|
describe 'Minitest::Hooks error handling' do
|
5
5
|
before(:all) do
|
6
|
-
name.must_equal
|
6
|
+
name.must_equal 'Minitest::Hooks error handling#before_all'
|
7
7
|
end
|
8
8
|
after(:all) do
|
9
|
-
name.must_equal
|
10
|
-
end
|
11
|
-
around do |&block|
|
9
|
+
name.must_equal 'Minitest::Hooks error handling#after_all'
|
12
10
|
end
|
13
11
|
around(:all) do |&block|
|
14
|
-
name.must_equal
|
12
|
+
name.must_equal 'Minitest::Hooks error handling#around_all'
|
15
13
|
super(&block)
|
16
|
-
name.must_equal
|
14
|
+
name.must_equal 'Minitest::Hooks error handling#around_all'
|
17
15
|
end
|
18
16
|
|
19
17
|
3.times do |i|
|
@@ -21,3 +19,24 @@ describe 'Minitest::Hooks error handling' do
|
|
21
19
|
end
|
22
20
|
end
|
23
21
|
end
|
22
|
+
|
23
|
+
class MinitestHooksNameTest < Minitest::Test
|
24
|
+
include Minitest::Hooks
|
25
|
+
|
26
|
+
def before_all
|
27
|
+
assert_equal 'MinitestHooksNameTest#before_all', name
|
28
|
+
end
|
29
|
+
def after_all
|
30
|
+
assert_equal 'MinitestHooksNameTest#after_all', name
|
31
|
+
end
|
32
|
+
def around_all
|
33
|
+
assert_equal 'MinitestHooksNameTest#around_all', name
|
34
|
+
super
|
35
|
+
assert_equal 'MinitestHooksNameTest#around_all', name
|
36
|
+
end
|
37
|
+
|
38
|
+
3.times do |i|
|
39
|
+
define_method "test_should_work_try_#{i}" do
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -8,7 +8,7 @@ describe 'Minitest::Hooks error handling' do
|
|
8
8
|
def self.run_test(desc, runs, errors)
|
9
9
|
it "should handle errors in #{desc}" do
|
10
10
|
ENV['MINITEST_HOOKS_ERRORS'] = desc
|
11
|
-
Open3.popen3(RUBY, "spec/errors/example.rb") do |_, o, e, w|
|
11
|
+
Open3.popen3(RUBY, "spec/errors/example.rb", "-v") do |_, o, e, w|
|
12
12
|
o.read.must_match /#{runs} runs, 0 assertions, 0 failures, #{errors} errors, 0 skips/
|
13
13
|
e.read.must_equal ''
|
14
14
|
w.value.exitstatus.wont_equal 0 if w
|
data/spec/minitest_hooks_spec.rb
CHANGED
data/spec/minitest_hooks_test.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-hooks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- lib/minitest/hooks.rb
|
87
87
|
- lib/minitest/hooks/default.rb
|
88
88
|
- lib/minitest/hooks/test.rb
|
89
|
+
- spec/all.rb
|
89
90
|
- spec/errors/example.rb
|
90
91
|
- spec/helper.rb
|
91
92
|
- spec/minitest_hooks_all_name_spec.rb
|
@@ -120,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
121
|
version: '0'
|
121
122
|
requirements: []
|
122
123
|
rubyforge_project:
|
123
|
-
rubygems_version: 2.6.
|
124
|
+
rubygems_version: 2.6.13
|
124
125
|
signing_key:
|
125
126
|
specification_version: 4
|
126
127
|
summary: Around and before_all/after_all/around_all hooks for Minitest
|