minitest-hooks 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/Rakefile +2 -0
- data/lib/minitest/hooks/test.rb +30 -6
- data/spec/errors/example.rb +34 -0
- data/spec/minitest_hooks_errors_spec.rb +27 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46c586c45d801e02455f2d74a92f50e01a17d879
|
4
|
+
data.tar.gz: e9d4dbde7545d3d5fbe792c83ddf2760a88944c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9d8417604cb8cb9b55bfea18bd4b6d5ce4668f7efa50fcfbe9f63211ba7217ff072b3769c8789bd6f7284604fd39a5452d0eace4718ced3206718e64925a4cf
|
7
|
+
data.tar.gz: 89eb265c8ec02d84cafa99440e80c6b681ef9e40d2f30207067b6ac773d2fe6a201827f0f484b406480e5a06d6c10e5166d64eb112fcd57ef79e14e52b071a6f
|
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
data/lib/minitest/hooks/test.rb
CHANGED
@@ -63,14 +63,38 @@ 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
|
+
inside = false
|
67
|
+
|
68
|
+
begin
|
69
|
+
@instance.around_all do
|
70
|
+
inside = true
|
71
|
+
begin
|
72
|
+
@instance.capture_exceptions do
|
73
|
+
@instance.before_all
|
74
|
+
end
|
66
75
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
76
|
+
if @instance.failure
|
77
|
+
failed = true
|
78
|
+
reporter.record @instance
|
79
|
+
else
|
80
|
+
super(reporter, &block)
|
81
|
+
end
|
82
|
+
ensure
|
83
|
+
@instance.capture_exceptions do
|
84
|
+
@instance.after_all
|
85
|
+
end
|
86
|
+
if @instance.failure && !failed
|
87
|
+
failed = true
|
88
|
+
reporter.record @instance
|
89
|
+
end
|
90
|
+
inside = false
|
91
|
+
end
|
73
92
|
end
|
93
|
+
rescue => e
|
94
|
+
@instance.capture_exceptions do
|
95
|
+
raise e
|
96
|
+
end
|
97
|
+
reporter.record @instance
|
74
98
|
end
|
75
99
|
end
|
76
100
|
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require './spec/helper'
|
2
|
+
require 'minitest/hooks/default'
|
3
|
+
|
4
|
+
error = ENV['MINITEST_HOOKS_ERRORS']
|
5
|
+
|
6
|
+
describe 'Minitest::Hooks error handling' do
|
7
|
+
before(:all) do
|
8
|
+
raise if error == 'before-all'
|
9
|
+
end
|
10
|
+
before do
|
11
|
+
raise if error == 'before'
|
12
|
+
end
|
13
|
+
after do
|
14
|
+
raise if error == 'after'
|
15
|
+
end
|
16
|
+
after(:all) do
|
17
|
+
raise if error == 'after-all'
|
18
|
+
end
|
19
|
+
around do |&block|
|
20
|
+
raise if error == 'around-before'
|
21
|
+
super(&block)
|
22
|
+
raise if error == 'around-after'
|
23
|
+
end
|
24
|
+
around(:all) do |&block|
|
25
|
+
raise if error == 'around-all-before'
|
26
|
+
super(&block)
|
27
|
+
raise if error == 'around-all-after'
|
28
|
+
end
|
29
|
+
|
30
|
+
3.times do |i|
|
31
|
+
it "should work try #{i}" do
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require './spec/helper'
|
2
|
+
require 'minitest/hooks/default'
|
3
|
+
require 'open3'
|
4
|
+
|
5
|
+
RUBY = ENV['RUBY'] || 'ruby'
|
6
|
+
|
7
|
+
describe 'Minitest::Hooks error handling' do
|
8
|
+
def self.run_test(desc, runs, errors)
|
9
|
+
it "should handle errors in #{desc}" do
|
10
|
+
ENV['MINITEST_HOOKS_ERRORS'] = desc
|
11
|
+
Open3.popen3(RUBY, "spec/errors/example.rb") do |_, o, e, w|
|
12
|
+
o.read.must_match /#{runs} runs, 0 assertions, 0 failures, #{errors} errors, 0 skips/
|
13
|
+
e.read.must_equal ''
|
14
|
+
w.value.exitstatus.wont_equal 0 if w
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
run_test "before-all", 1, 1
|
20
|
+
run_test "before", 3, 3
|
21
|
+
run_test "after", 3, 3
|
22
|
+
run_test "after-all", 4, 1
|
23
|
+
run_test "around-before", 1, 1
|
24
|
+
run_test "around-after", 1, 1
|
25
|
+
run_test "around-all-before", 1, 1
|
26
|
+
run_test "around-all-after", 4, 1
|
27
|
+
end
|
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
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -86,8 +86,10 @@ files:
|
|
86
86
|
- lib/minitest/hooks.rb
|
87
87
|
- lib/minitest/hooks/default.rb
|
88
88
|
- lib/minitest/hooks/test.rb
|
89
|
+
- spec/errors/example.rb
|
89
90
|
- spec/helper.rb
|
90
91
|
- spec/minitest_hooks_direct_spec.rb
|
92
|
+
- spec/minitest_hooks_errors_spec.rb
|
91
93
|
- spec/minitest_hooks_spec.rb
|
92
94
|
- spec/minitest_hooks_test.rb
|
93
95
|
homepage: http://github.com/jeremyevans/minitest-hooks
|
@@ -117,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
119
|
version: '0'
|
118
120
|
requirements: []
|
119
121
|
rubyforge_project:
|
120
|
-
rubygems_version: 2.4.5
|
122
|
+
rubygems_version: 2.4.5.1
|
121
123
|
signing_key:
|
122
124
|
specification_version: 4
|
123
125
|
summary: Around and before_all/after_all/around_all hooks for Minitest
|