test-unit-context 0.5.0 → 0.5.1
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 +13 -5
- data/.travis.yml +13 -10
- data/LICENSE +1 -1
- data/README.md +8 -9
- data/lib/test/unit/context/context.rb +4 -4
- data/lib/test/unit/context/version.rb +1 -1
- data/lib/test/unit/patches.rb +25 -13
- data/test-unit-context.gemspec +14 -13
- data/test/test/unit/context/hooks_test.rb +118 -75
- data/test/test_helper.rb +1 -0
- metadata +22 -18
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
OWM1MGRiMmE5MWY4ZTA0OWM1NjIxYWIxMjBlNjBiMGI4YzMxYWUwNQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YjIzNjdiNDA1NjllYmVkODQwNmEwZjA4MTE0YTYyYTNmNTUyNDBhMQ==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
N2VjNjgwZDcyZDA4YmM4Zjk3NDIwYzg4ZjQ2ZDRhN2EzZWU3MWY5OGE4OTU2
|
10
|
+
NTk4YTNiZDA1MzkxOTAwYzU0YWNlZjI1MjkyNmI2NTA0ZWUzZTVjMjEyNjQy
|
11
|
+
NDc1NjkxOGQ0YzM1NTEyNmYyZDAxZGMwM2JmYjI5ZDg3YTcxZTA=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NTg3MDhkNTZkZWYyYmZmNTZjYmE3MjYxMDgwNWNhMjhlNzM3YjM0N2U0YzUy
|
14
|
+
MTc3ZDdlNTc5MjY5ZTI2ZWRmZjhjMDU0ODRmMTY3Y2IzOTQ5NDcyNDgxZWI1
|
15
|
+
OTFiOWE4MTY2MTAyN2EyMDg2ZThiMmEwN2E5ZWQ5ZmI3NTkyNTU=
|
data/.travis.yml
CHANGED
@@ -1,18 +1,21 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 1.8.7
|
4
3
|
- 1.9.3
|
5
|
-
- 2.
|
6
|
-
-
|
7
|
-
- jruby-1.7.
|
4
|
+
- 2.2.3
|
5
|
+
- 2.3.0
|
6
|
+
- jruby-1.7.22
|
7
|
+
- jruby-9.0.4.0
|
8
8
|
jdk:
|
9
9
|
- openjdk7
|
10
10
|
env:
|
11
|
-
- TEST_UNIT="~> 2.5
|
12
|
-
- TEST_UNIT="~> 3.0
|
11
|
+
- TEST_UNIT="~> 2.5"
|
12
|
+
- TEST_UNIT="~> 3.0"
|
13
|
+
- TEST_UNIT="~> 3.1"
|
14
|
+
before_install:
|
15
|
+
- ((ruby -v | grep 1.8.7) && ruby -S gem install bundler -v '~> 1.8.9') || true
|
16
|
+
- ((ruby -v | grep 1.9.3) && ruby -S gem install bundler -v '~> 1.8.9') || true
|
13
17
|
matrix:
|
14
|
-
|
18
|
+
include:
|
15
19
|
- rvm: 1.8.7
|
16
|
-
env: TEST_UNIT="~>
|
17
|
-
|
18
|
-
env: TEST_UNIT="~> 3.0.9"
|
20
|
+
env: TEST_UNIT="~> 2.5"
|
21
|
+
jdk: openjdk6 # jdk_switcher use ["openjdk7"]" failed and exited with 1
|
data/LICENSE
CHANGED
@@ -186,7 +186,7 @@
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
187
187
|
identification within third-party archives.
|
188
188
|
|
189
|
-
Copyright (c) 2012 Karol Bucek
|
189
|
+
Copyright (c) 2012-2016 [Karol Bucek](http://kares.org)
|
190
190
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
192
192
|
you may not use this file except in compliance with the License.
|
data/README.md
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
[![Build Status][0]](http://travis-ci.org/kares/test-unit-context)
|
4
4
|
|
5
|
-
Makes `Test::Unit::TestCase` 'context-able' and thus (subjectively - hopefully)
|
6
|
-
much easier to read and write. If you have ever seen RSpec than it's the very
|
7
|
-
same *context do ... end* re-invented for **Test::Unit**.
|
5
|
+
Makes `Test::Unit::TestCase` 'context-able' and thus (subjectively - hopefully)
|
6
|
+
much easier to read and write. If you have ever seen RSpec than it's the very
|
7
|
+
same *context do ... end* re-invented for **Test::Unit**.
|
8
8
|
|
9
|
-
Inspired by [gem 'context'](https://github.com/jm/context) that does the same
|
9
|
+
Inspired by [gem 'context'](https://github.com/jm/context) that does the same
|
10
10
|
for the good 'old' test-unit 1.2.3 bundled with Ruby 1.8.x standard libraries.
|
11
11
|
|
12
12
|
## Installation
|
@@ -25,7 +25,6 @@ Or install it yourself, if you're not using Bundler :
|
|
25
25
|
## Usage
|
26
26
|
|
27
27
|
```ruby
|
28
|
-
# NOTE: do not run try running this at home!
|
29
28
|
class ChuckNorrisTest < Test::Unit::TestCase
|
30
29
|
|
31
30
|
setup do
|
@@ -76,7 +75,7 @@ class ChuckNorrisTest < Test::Unit::TestCase
|
|
76
75
|
uses 'elementary math facts'
|
77
76
|
|
78
77
|
context 'cloned' do
|
79
|
-
|
78
|
+
|
80
79
|
setup do
|
81
80
|
@subject = @subject.clone
|
82
81
|
end
|
@@ -91,7 +90,6 @@ class ChuckNorrisTest < Test::Unit::TestCase
|
|
91
90
|
end
|
92
91
|
|
93
92
|
end
|
94
|
-
|
95
93
|
```
|
96
94
|
|
97
95
|
### Spec Mode
|
@@ -113,11 +111,12 @@ describe ChuckNorris, '#fart' do
|
|
113
111
|
end
|
114
112
|
|
115
113
|
end
|
114
|
+
# NOTE: do not try running this at home!
|
116
115
|
```
|
117
116
|
|
118
117
|
## Copyright
|
119
118
|
|
120
|
-
Copyright (c)
|
119
|
+
Copyright (c) 2016 [Karol Bucek](https://github.com/kares).
|
121
120
|
See LICENSE (http://www.apache.org/licenses/LICENSE-2.0) for details.
|
122
121
|
|
123
|
-
[0]: https://secure.travis-ci.org/kares/test-unit-context.png
|
122
|
+
[0]: https://secure.travis-ci.org/kares/test-unit-context.png
|
@@ -40,12 +40,12 @@ module Test::Unit::Context
|
|
40
40
|
if const_defined?(class_name)
|
41
41
|
klass = const_get(class_name)
|
42
42
|
if ( klass.superclass == self rescue nil )
|
43
|
-
warn "duplicate context definition with the name #{name.inspect} "
|
44
|
-
"found at #{caller.first} it is going to be merged with "
|
43
|
+
warn "duplicate context definition with the name #{name.inspect} " +
|
44
|
+
"found at #{caller.first} it is going to be merged with " +
|
45
45
|
"the previous context definition"
|
46
46
|
else
|
47
|
-
raise "could not create a context with the name #{name.inspect} "
|
48
|
-
"as a constant #{class_name} is already defined and is not "
|
47
|
+
raise "could not create a context with the name #{name.inspect} " +
|
48
|
+
"as a constant #{class_name} is already defined and is not " +
|
49
49
|
"another context definition"
|
50
50
|
end
|
51
51
|
else
|
data/lib/test/unit/patches.rb
CHANGED
@@ -10,25 +10,37 @@ module Test::Unit
|
|
10
10
|
end
|
11
11
|
TestSuiteCreator.class_eval do
|
12
12
|
|
13
|
+
unless respond_to?(:test_method?)
|
14
|
+
require 'test/unit/attribute' unless Test::Unit.const_defined? :Attribute
|
15
|
+
if Test::Unit::Attribute::ClassMethods.method_defined?(:find_attribute)
|
16
|
+
def self.test_method?(test_case, method_name)
|
17
|
+
method_name = method_name.to_s
|
18
|
+
( method_name.start_with?('test') && method_name.length > 4 ) ||
|
19
|
+
test_case.find_attribute(method_name, :test)
|
20
|
+
end
|
21
|
+
else
|
22
|
+
def self.test_method?(test_case, method_name)
|
23
|
+
method_name = method_name.to_s
|
24
|
+
( method_name.start_with?('test') && method_name.length > 4 ) ||
|
25
|
+
test_case.attributes(method_name)[:test]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
13
30
|
private
|
14
31
|
|
15
32
|
def collect_test_names
|
16
33
|
methods = @test_case.public_instance_methods(true)
|
17
|
-
|
18
|
-
while
|
19
|
-
methods -=
|
20
|
-
|
34
|
+
super_test_case = @test_case.superclass
|
35
|
+
while super_test_case && super_test_case != TestCase
|
36
|
+
methods -= super_test_case.public_instance_methods(true)
|
37
|
+
super_test_case = super_test_case.superclass
|
21
38
|
end
|
22
|
-
methods.map!(&:to_s)
|
23
|
-
|
24
|
-
|
25
|
-
# method_name =~ /^test./
|
26
|
-
( method_name.start_with?('test') && method_name.length > 4 ) ||
|
27
|
-
( use_find_attribute ? # since Test-Unit 3.0
|
28
|
-
@test_case.find_attribute(method_name, :test) :
|
29
|
-
@test_case.attributes(method_name)[:test] )
|
39
|
+
method_names = methods.map!(&:to_s)
|
40
|
+
test_names = method_names.find_all do |method_name|
|
41
|
+
self.class.test_method?(@test_case, method_name)
|
30
42
|
end
|
31
|
-
|
43
|
+
__send__("sort_test_names_in_#{@test_case.test_order}_order", test_names)
|
32
44
|
end
|
33
45
|
|
34
46
|
end
|
data/test-unit-context.gemspec
CHANGED
@@ -1,26 +1,27 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require 'test/unit/context/version'
|
4
2
|
|
5
3
|
Gem::Specification.new do |gem|
|
6
|
-
gem.name =
|
7
|
-
gem.
|
8
|
-
gem.
|
9
|
-
gem.
|
10
|
-
|
4
|
+
gem.name = 'test-unit-context'
|
5
|
+
gem.authors = ['Karol Bucek']
|
6
|
+
gem.email = ['self@kares.org']
|
7
|
+
gem.licenses = ['Apache-2.0']
|
8
|
+
|
9
|
+
path = File.expand_path("lib/test/unit/context/version.rb", File.dirname(__FILE__))
|
10
|
+
gem.version = File.read(path).match( /.*VERSION\s*=\s*['"](.*)['"]/m )[1]
|
11
|
+
|
11
12
|
gem.summary = %q{Context for Test::Unit (2.x)}
|
12
13
|
gem.description = %q{Makes Test::Unit::TestCases 'contextable' and thus much
|
13
|
-
easier to read and write. If you've seen RSpec than it's the very same 'context
|
14
|
-
do ... end' re-invendet for Test::Unit. Inspired by gem 'context' that does
|
15
|
-
|
16
|
-
gem.homepage = "
|
14
|
+
easier to read and write. If you've seen RSpec than it's the very same 'context
|
15
|
+
do ... end' re-invendet for Test::Unit. Inspired by gem 'context' that does a
|
16
|
+
similar job for the 'old' Test::Unit bundled with Ruby 1.8.x standard libraries.}
|
17
|
+
gem.homepage = "https://github.com/kares/test-unit-context"
|
17
18
|
|
18
19
|
gem.require_paths = ["lib"]
|
19
20
|
gem.files = `git ls-files`.split("\n")
|
20
21
|
gem.test_files = `git ls-files -- {test}/*`.split("\n")
|
21
|
-
|
22
|
+
|
22
23
|
gem.extra_rdoc_files = %w[ README.md LICENSE ]
|
23
|
-
|
24
|
+
|
24
25
|
gem.add_dependency 'test-unit', '>= 2.4.0'
|
25
26
|
gem.add_development_dependency 'rake'
|
26
27
|
end
|
@@ -2,14 +2,14 @@ require File.expand_path('../../../test_helper', File.dirname(__FILE__))
|
|
2
2
|
|
3
3
|
module Test::Unit::Context
|
4
4
|
class TestHooks < Test::Unit::TestCase
|
5
|
-
|
5
|
+
|
6
6
|
class << self; alias_method :it, :test; end
|
7
|
-
|
7
|
+
|
8
8
|
setup do
|
9
9
|
@inherited_before_each_var ||= 0
|
10
10
|
@inherited_before_each_var += 1
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
attr_reader :inherited_before_each_var
|
14
14
|
|
15
15
|
def setup
|
@@ -20,29 +20,29 @@ module Test::Unit::Context
|
|
20
20
|
end
|
21
21
|
|
22
22
|
attr_reader :inherited_before_each_var_2
|
23
|
-
|
23
|
+
|
24
24
|
def teardown
|
25
25
|
@inherited_after_each_var ||= 0
|
26
26
|
@inherited_after_each_var += 1
|
27
27
|
end
|
28
28
|
|
29
29
|
attr_reader :inherited_after_each_var
|
30
|
-
|
30
|
+
|
31
31
|
startup do
|
32
32
|
@inherited_before_all_var ||= 0
|
33
33
|
@inherited_before_all_var += 1
|
34
34
|
end
|
35
35
|
|
36
36
|
attr_reader :inherited_before_all_var
|
37
|
-
|
37
|
+
|
38
38
|
shutdown do
|
39
39
|
@inherited_after_all_var ||= 0
|
40
40
|
@inherited_after_all_var += 1
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
attr_reader :inherited_after_all_var
|
44
|
-
|
45
|
-
|
44
|
+
|
45
|
+
SAMPLE_TEST1 = context "hooks1" do
|
46
46
|
|
47
47
|
setup do
|
48
48
|
@inherited_before_each_var ||= 0
|
@@ -55,13 +55,17 @@ module Test::Unit::Context
|
|
55
55
|
end
|
56
56
|
|
57
57
|
attr_reader :after_each_var
|
58
|
-
|
58
|
+
|
59
59
|
teardown :a_method
|
60
60
|
|
61
61
|
test "foo" do
|
62
62
|
assert :foo
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
|
+
# @override so its not auto-run
|
66
|
+
alias_method :default_run, :run
|
67
|
+
def run(result); result end
|
68
|
+
|
65
69
|
end
|
66
70
|
|
67
71
|
setup
|
@@ -71,7 +75,7 @@ module Test::Unit::Context
|
|
71
75
|
end
|
72
76
|
|
73
77
|
attr_reader :superclass_before_each_var
|
74
|
-
|
78
|
+
|
75
79
|
teardown
|
76
80
|
def a_teardown
|
77
81
|
@superclass_after_each_var ||= 0
|
@@ -79,7 +83,7 @@ module Test::Unit::Context
|
|
79
83
|
end
|
80
84
|
|
81
85
|
attr_reader :superclass_after_each_var
|
82
|
-
|
86
|
+
|
83
87
|
context "with (inherited) setup/teadown hooks" do
|
84
88
|
|
85
89
|
it "runs superclass before callbacks in order" do
|
@@ -109,48 +113,57 @@ module Test::Unit::Context
|
|
109
113
|
it "runs after callbacks specified with method names, instead of blocks" do
|
110
114
|
assert_equal "a method ran", @test.ivar
|
111
115
|
end
|
112
|
-
|
116
|
+
|
113
117
|
setup do
|
114
|
-
|
115
|
-
@test =
|
116
|
-
@test.
|
118
|
+
result = Test::Unit::TestResult.new
|
119
|
+
@test = SAMPLE_TEST1.new("test: foo")
|
120
|
+
@test.default_run(result) { |inherited_after_each_var, v| }
|
121
|
+
verify_result_passed! result
|
117
122
|
end
|
118
|
-
|
123
|
+
|
119
124
|
end
|
120
125
|
|
121
|
-
|
126
|
+
SAMPLE_TEST2 = context "hooks2" do
|
122
127
|
|
123
|
-
SAMPLE_TEST.class_eval do
|
124
|
-
OLD_SETUP = instance_method(:setup)
|
125
|
-
OLD_TEARDOWN = instance_method(:teardown)
|
126
|
-
end
|
127
|
-
|
128
128
|
setup do
|
129
|
-
|
130
|
-
|
131
|
-
@superclass_before_each_var ||= 0
|
132
|
-
@inherited_before_each_var_2 ||= 9
|
133
|
-
end
|
134
|
-
def teardown
|
135
|
-
@superclass_after_each_var ||= 0
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
@result = Test::Unit::TestResult.new
|
140
|
-
@test = SAMPLE_TEST.new("test: hooks foo")
|
141
|
-
@test.run(@result) { |inherited_after_each_var, v| }
|
129
|
+
@inherited_before_each_var ||= 0
|
130
|
+
@inherited_before_each_var += 4
|
142
131
|
end
|
143
|
-
|
132
|
+
|
144
133
|
teardown do
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
134
|
+
@after_each_var ||= 0
|
135
|
+
@after_each_var += 1
|
136
|
+
end
|
137
|
+
|
138
|
+
def setup
|
139
|
+
@superclass_before_each_var ||= 0
|
140
|
+
@inherited_before_each_var_2 ||= 9
|
141
|
+
end
|
142
|
+
|
143
|
+
def teardown
|
144
|
+
@superclass_after_each_var ||= 0
|
145
|
+
end
|
146
|
+
|
147
|
+
attr_reader :after_each_var
|
148
|
+
|
149
|
+
test "foo" do
|
150
|
+
assert :foo
|
152
151
|
end
|
153
|
-
|
152
|
+
|
153
|
+
# @override so its not auto-run
|
154
|
+
alias_method :default_run, :run
|
155
|
+
def run(result); result end
|
156
|
+
|
157
|
+
end
|
158
|
+
|
159
|
+
context "with redefined setup/teadown methods" do
|
160
|
+
|
161
|
+
setup do
|
162
|
+
@result = Test::Unit::TestResult.new
|
163
|
+
@test = SAMPLE_TEST2.new("test: foo")
|
164
|
+
@test.default_run(@result) { |inherited_after_each_var, v| }
|
165
|
+
end
|
166
|
+
|
154
167
|
it "runs superclass before callbacks" do
|
155
168
|
assert_equal 1, @test.superclass_before_each_var
|
156
169
|
end
|
@@ -158,24 +171,54 @@ module Test::Unit::Context
|
|
158
171
|
it "runs superclass after callbacks" do
|
159
172
|
assert_equal 1, @test.superclass_after_each_var
|
160
173
|
end
|
161
|
-
|
174
|
+
|
162
175
|
it "does not run inherited (re-defined) setup method" do
|
163
176
|
assert_equal 9, @test.inherited_before_each_var_2
|
164
177
|
end
|
165
|
-
|
178
|
+
|
166
179
|
it "runs inherited before callbacks (except previous setup method)" do
|
167
180
|
assert_equal 5, @test.inherited_before_each_var
|
168
181
|
end
|
169
|
-
|
182
|
+
|
170
183
|
end
|
171
|
-
|
184
|
+
|
185
|
+
SAMPLE_TEST3 = context "hooks3" do
|
186
|
+
|
187
|
+
setup do
|
188
|
+
#puts "hooks3 setup \n #{caller.join("\n ")}"
|
189
|
+
@inherited_before_each_var ||= 0
|
190
|
+
@inherited_before_each_var += 4
|
191
|
+
end
|
192
|
+
|
193
|
+
teardown do
|
194
|
+
@after_each_var ||= 0
|
195
|
+
@after_each_var += 1
|
196
|
+
end
|
197
|
+
|
198
|
+
attr_reader :after_each_var
|
199
|
+
|
200
|
+
test "foo" do
|
201
|
+
assert :foo
|
202
|
+
end
|
203
|
+
|
204
|
+
# @override so its not auto-run
|
205
|
+
alias_method :default_run, :run
|
206
|
+
def run(result); result end
|
207
|
+
|
208
|
+
end
|
209
|
+
|
172
210
|
# test that we aren't stomping on defined setup method
|
173
211
|
context "with setup/teardown methods" do
|
174
|
-
|
212
|
+
|
213
|
+
SAMPLE_TEST3.class_eval { attr_reader :one, :two }
|
214
|
+
|
175
215
|
setup
|
176
216
|
def custom_setup
|
177
|
-
|
178
|
-
@
|
217
|
+
|
218
|
+
#SAMPLE_TEST3.setup { @one = 1 }
|
219
|
+
#SAMPLE_TEST3.teardown { @two = 10 }
|
220
|
+
|
221
|
+
@test = SAMPLE_TEST3.new("test: foo")
|
179
222
|
|
180
223
|
@test.class.setup do
|
181
224
|
@one = 1
|
@@ -185,55 +228,55 @@ module Test::Unit::Context
|
|
185
228
|
@two = 10
|
186
229
|
end
|
187
230
|
|
188
|
-
|
231
|
+
result = Test::Unit::TestResult.new
|
232
|
+
@test.default_run(result) { |inherited_after_each_var, v| }
|
233
|
+
verify_result_passed! result
|
189
234
|
end
|
190
|
-
|
191
|
-
SAMPLE_TEST.class_eval { attr_reader :one, :two }
|
192
|
-
|
235
|
+
|
193
236
|
it "runs setup method block a la Shoulda" do
|
194
237
|
assert_equal 1, @test.one
|
195
238
|
end
|
196
239
|
|
197
|
-
it "runs setup method block and regular callbacks" do
|
198
|
-
assert_equal 7, @test.inherited_before_each_var
|
199
|
-
end
|
200
|
-
|
201
240
|
it "runs teardown method block a la Shoulda" do
|
202
241
|
assert_equal 10, @test.two
|
203
242
|
end
|
204
243
|
|
205
244
|
it "runs teardown method block and regular callbacks" do
|
245
|
+
assert_equal 7, @test.inherited_before_each_var
|
206
246
|
assert_equal 1, @test.after_each_var
|
207
247
|
end
|
208
|
-
|
248
|
+
|
209
249
|
end
|
210
250
|
|
211
251
|
def self.startup
|
212
252
|
@superclass_before_all_var ||= 0
|
213
253
|
@superclass_before_all_var += 1
|
214
254
|
end
|
215
|
-
|
255
|
+
|
216
256
|
def self.shutdown
|
217
257
|
@superclass_after_all_var ||= 0
|
218
258
|
@superclass_after_all_var += 1
|
219
259
|
end
|
220
|
-
|
221
|
-
context "To be compatible with rails' expectations" do
|
222
|
-
setup :a_method
|
223
|
-
|
224
|
-
test "should accept a symbol for an argument to setup and run that method at setup time" do
|
225
|
-
assert_equal "a method ran", @ivar
|
226
|
-
end
|
227
|
-
end
|
228
260
|
|
229
261
|
protected
|
230
|
-
|
262
|
+
|
231
263
|
attr_reader :ivar
|
232
|
-
|
264
|
+
|
233
265
|
def a_method
|
234
266
|
@ivar = "a method ran"
|
235
267
|
end
|
236
|
-
|
268
|
+
|
269
|
+
private
|
270
|
+
|
271
|
+
def verify_result_passed!(test_result)
|
272
|
+
unless test_result.passed?
|
273
|
+
#raise test_result.faults[0] if test_result.faults.size == 1
|
274
|
+
#raise "test run failed: #{result.summary}\n#{faults.inspect}"
|
275
|
+
warn "test run failed: #{test_result.summary}\n#{test_result.inspect}"
|
276
|
+
raise test_result.faults.first unless test_result.faults.empty?
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
237
280
|
end
|
238
|
-
|
281
|
+
|
239
282
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,47 +1,50 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-unit-context
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Karol Bucek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-unit
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ! '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 2.4.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.4.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ! '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ! '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
description:
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
description: ! 'Makes Test::Unit::TestCases ''contextable'' and thus much
|
42
|
+
|
43
|
+
easier to read and write. If you''ve seen RSpec than it''s the very same ''context
|
44
|
+
|
45
|
+
do ... end'' re-invendet for Test::Unit. Inspired by gem ''context'' that does a
|
46
|
+
|
47
|
+
similar job for the ''old'' Test::Unit bundled with Ruby 1.8.x standard libraries.'
|
45
48
|
email:
|
46
49
|
- self@kares.org
|
47
50
|
executables: []
|
@@ -50,8 +53,8 @@ extra_rdoc_files:
|
|
50
53
|
- README.md
|
51
54
|
- LICENSE
|
52
55
|
files:
|
53
|
-
-
|
54
|
-
-
|
56
|
+
- .gitignore
|
57
|
+
- .travis.yml
|
55
58
|
- Gemfile
|
56
59
|
- LICENSE
|
57
60
|
- README.md
|
@@ -71,8 +74,9 @@ files:
|
|
71
74
|
- test/test/unit/context_test.rb
|
72
75
|
- test/test/unit/patches_test.rb
|
73
76
|
- test/test_helper.rb
|
74
|
-
homepage:
|
75
|
-
licenses:
|
77
|
+
homepage: https://github.com/kares/test-unit-context
|
78
|
+
licenses:
|
79
|
+
- Apache-2.0
|
76
80
|
metadata: {}
|
77
81
|
post_install_message:
|
78
82
|
rdoc_options: []
|
@@ -80,17 +84,17 @@ require_paths:
|
|
80
84
|
- lib
|
81
85
|
required_ruby_version: !ruby/object:Gem::Requirement
|
82
86
|
requirements:
|
83
|
-
- -
|
87
|
+
- - ! '>='
|
84
88
|
- !ruby/object:Gem::Version
|
85
89
|
version: '0'
|
86
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
91
|
requirements:
|
88
|
-
- -
|
92
|
+
- - ! '>='
|
89
93
|
- !ruby/object:Gem::Version
|
90
94
|
version: '0'
|
91
95
|
requirements: []
|
92
96
|
rubyforge_project:
|
93
|
-
rubygems_version: 2.
|
97
|
+
rubygems_version: 2.5.1
|
94
98
|
signing_key:
|
95
99
|
specification_version: 4
|
96
100
|
summary: Context for Test::Unit (2.x)
|