mocha 1.14.0 → 2.0.0.alpha
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/.rubocop.yml +1 -1
- data/Gemfile +3 -5
- data/README.md +1 -1
- data/RELEASE.md +52 -0
- data/Rakefile +19 -20
- data/gemfiles/Gemfile.test-unit.latest +1 -5
- data/lib/mocha/any_instance_method.rb +0 -5
- data/lib/mocha/api.rb +29 -78
- data/lib/mocha/class_methods.rb +2 -2
- data/lib/mocha/configuration.rb +30 -108
- data/lib/mocha/expectation.rb +55 -7
- data/lib/mocha/inspect.rb +2 -2
- data/lib/mocha/instance_method.rb +0 -4
- data/lib/mocha/integration/mini_test.rb +10 -38
- data/lib/mocha/integration/test_unit/adapter.rb +1 -1
- data/lib/mocha/integration/test_unit.rb +10 -33
- data/lib/mocha/invocation.rb +12 -16
- data/lib/mocha/minitest.rb +2 -4
- data/lib/mocha/mock.rb +22 -26
- data/lib/mocha/mockery.rb +1 -3
- data/lib/mocha/parameter_matchers/equivalent_uri.rb +0 -1
- data/lib/mocha/parameter_matchers/instance_methods.rb +9 -0
- data/lib/mocha/parameter_matchers/positional_or_keyword_hash.rb +56 -0
- data/lib/mocha/parameters_matcher.rb +0 -1
- data/lib/mocha/ruby_version.rb +1 -2
- data/lib/mocha/stubbed_method.rb +5 -42
- data/lib/mocha/test_unit.rb +2 -4
- data/lib/mocha/version.rb +1 -1
- data/lib/mocha.rb +0 -8
- data/mocha.gemspec +1 -1
- metadata +7 -27
- data/init.rb +0 -1
- data/lib/mocha/integration/mini_test/nothing.rb +0 -19
- data/lib/mocha/integration/mini_test/version_13.rb +0 -54
- data/lib/mocha/integration/mini_test/version_140.rb +0 -54
- data/lib/mocha/integration/mini_test/version_141.rb +0 -65
- data/lib/mocha/integration/mini_test/version_142_to_172.rb +0 -65
- data/lib/mocha/integration/mini_test/version_200.rb +0 -66
- data/lib/mocha/integration/mini_test/version_201_to_222.rb +0 -66
- data/lib/mocha/integration/mini_test/version_2110_to_2111.rb +0 -70
- data/lib/mocha/integration/mini_test/version_2112_to_320.rb +0 -73
- data/lib/mocha/integration/mini_test/version_230_to_2101.rb +0 -68
- data/lib/mocha/integration/test_unit/gem_version_200.rb +0 -62
- data/lib/mocha/integration/test_unit/gem_version_201_to_202.rb +0 -62
- data/lib/mocha/integration/test_unit/gem_version_203_to_220.rb +0 -62
- data/lib/mocha/integration/test_unit/gem_version_230_to_250.rb +0 -68
- data/lib/mocha/integration/test_unit/nothing.rb +0 -19
- data/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb +0 -61
- data/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb +0 -63
- data/lib/mocha/integration.rb +0 -11
- data/lib/mocha/setup.rb +0 -14
- data/lib/mocha/singleton_class.rb +0 -9
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mocha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0.alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Mead
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Mocking and stubbing library with JMock/SchMock syntax, which allows
|
14
14
|
mocking and stubbing of methods on real (non-mock) classes.
|
@@ -31,7 +31,6 @@ files:
|
|
31
31
|
- Rakefile
|
32
32
|
- gemfiles/Gemfile.minitest.latest
|
33
33
|
- gemfiles/Gemfile.test-unit.latest
|
34
|
-
- init.rb
|
35
34
|
- lib/mocha.rb
|
36
35
|
- lib/mocha/any_instance_method.rb
|
37
36
|
- lib/mocha/api.rb
|
@@ -57,31 +56,13 @@ files:
|
|
57
56
|
- lib/mocha/in_state_ordering_constraint.rb
|
58
57
|
- lib/mocha/inspect.rb
|
59
58
|
- lib/mocha/instance_method.rb
|
60
|
-
- lib/mocha/integration.rb
|
61
59
|
- lib/mocha/integration/assertion_counter.rb
|
62
60
|
- lib/mocha/integration/mini_test.rb
|
63
61
|
- lib/mocha/integration/mini_test/adapter.rb
|
64
62
|
- lib/mocha/integration/mini_test/exception_translation.rb
|
65
|
-
- lib/mocha/integration/mini_test/nothing.rb
|
66
|
-
- lib/mocha/integration/mini_test/version_13.rb
|
67
|
-
- lib/mocha/integration/mini_test/version_140.rb
|
68
|
-
- lib/mocha/integration/mini_test/version_141.rb
|
69
|
-
- lib/mocha/integration/mini_test/version_142_to_172.rb
|
70
|
-
- lib/mocha/integration/mini_test/version_200.rb
|
71
|
-
- lib/mocha/integration/mini_test/version_201_to_222.rb
|
72
|
-
- lib/mocha/integration/mini_test/version_2110_to_2111.rb
|
73
|
-
- lib/mocha/integration/mini_test/version_2112_to_320.rb
|
74
|
-
- lib/mocha/integration/mini_test/version_230_to_2101.rb
|
75
63
|
- lib/mocha/integration/monkey_patcher.rb
|
76
64
|
- lib/mocha/integration/test_unit.rb
|
77
65
|
- lib/mocha/integration/test_unit/adapter.rb
|
78
|
-
- lib/mocha/integration/test_unit/gem_version_200.rb
|
79
|
-
- lib/mocha/integration/test_unit/gem_version_201_to_202.rb
|
80
|
-
- lib/mocha/integration/test_unit/gem_version_203_to_220.rb
|
81
|
-
- lib/mocha/integration/test_unit/gem_version_230_to_250.rb
|
82
|
-
- lib/mocha/integration/test_unit/nothing.rb
|
83
|
-
- lib/mocha/integration/test_unit/ruby_version_185_and_below.rb
|
84
|
-
- lib/mocha/integration/test_unit/ruby_version_186_and_above.rb
|
85
66
|
- lib/mocha/invocation.rb
|
86
67
|
- lib/mocha/is_a.rb
|
87
68
|
- lib/mocha/logger.rb
|
@@ -113,6 +94,7 @@ files:
|
|
113
94
|
- lib/mocha/parameter_matchers/kind_of.rb
|
114
95
|
- lib/mocha/parameter_matchers/not.rb
|
115
96
|
- lib/mocha/parameter_matchers/optionally.rb
|
97
|
+
- lib/mocha/parameter_matchers/positional_or_keyword_hash.rb
|
116
98
|
- lib/mocha/parameter_matchers/regexp_matches.rb
|
117
99
|
- lib/mocha/parameter_matchers/responds_with.rb
|
118
100
|
- lib/mocha/parameter_matchers/yaml_equivalent.rb
|
@@ -122,9 +104,7 @@ files:
|
|
122
104
|
- lib/mocha/return_values.rb
|
123
105
|
- lib/mocha/ruby_version.rb
|
124
106
|
- lib/mocha/sequence.rb
|
125
|
-
- lib/mocha/setup.rb
|
126
107
|
- lib/mocha/single_return_value.rb
|
127
|
-
- lib/mocha/singleton_class.rb
|
128
108
|
- lib/mocha/state_machine.rb
|
129
109
|
- lib/mocha/stubbed_method.rb
|
130
110
|
- lib/mocha/stubbing_error.rb
|
@@ -149,14 +129,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
149
129
|
requirements:
|
150
130
|
- - ">="
|
151
131
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
132
|
+
version: '2.0'
|
153
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
134
|
requirements:
|
155
|
-
- - "
|
135
|
+
- - ">"
|
156
136
|
- !ruby/object:Gem::Version
|
157
|
-
version:
|
137
|
+
version: 1.3.1
|
158
138
|
requirements: []
|
159
|
-
rubygems_version: 3.
|
139
|
+
rubygems_version: 3.3.3
|
160
140
|
signing_key:
|
161
141
|
specification_version: 4
|
162
142
|
summary: Mocking and stubbing library
|
data/init.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
warn 'Mocha deprecation warning: The old-style Rails plugin will not be supported in future versions of Mocha.'
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Mocha
|
2
|
-
module Integration
|
3
|
-
module MiniTest
|
4
|
-
module Nothing
|
5
|
-
def self.applicable_to?(_test_unit_version, _ruby_version = nil)
|
6
|
-
true
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.description
|
10
|
-
'nothing (no MiniTest integration available)'
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.included(_mod)
|
14
|
-
raise 'No MiniTest integration available'
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
require 'mocha/integration/assertion_counter'
|
2
|
-
require 'mocha/integration/monkey_patcher'
|
3
|
-
require 'mocha/integration/mini_test/exception_translation'
|
4
|
-
|
5
|
-
module Mocha
|
6
|
-
module Integration
|
7
|
-
module MiniTest
|
8
|
-
module Version13
|
9
|
-
def self.applicable_to?(mini_test_version)
|
10
|
-
Gem::Requirement.new('>= 1.3.0', '<= 1.3.1').satisfied_by?(mini_test_version)
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.description
|
14
|
-
'monkey patch for MiniTest gem v1.3'
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.included(mod)
|
18
|
-
MonkeyPatcher.apply(mod, RunMethodPatch)
|
19
|
-
end
|
20
|
-
|
21
|
-
module RunMethodPatch
|
22
|
-
# rubocop:disable all
|
23
|
-
def run runner
|
24
|
-
assertion_counter = AssertionCounter.new(self)
|
25
|
-
result = '.'
|
26
|
-
begin
|
27
|
-
begin
|
28
|
-
@passed = nil
|
29
|
-
mocha_setup
|
30
|
-
self.setup
|
31
|
-
self.__send__ self.name
|
32
|
-
mocha_verify(assertion_counter)
|
33
|
-
@passed = true
|
34
|
-
rescue Exception => e
|
35
|
-
@passed = false
|
36
|
-
result = runner.puke(self.class, self.name, Mocha::Integration::MiniTest.translate(e))
|
37
|
-
ensure
|
38
|
-
begin
|
39
|
-
self.teardown
|
40
|
-
rescue Exception => e
|
41
|
-
result = runner.puke(self.class, self.name, Mocha::Integration::MiniTest.translate(e))
|
42
|
-
end
|
43
|
-
end
|
44
|
-
ensure
|
45
|
-
mocha_teardown
|
46
|
-
end
|
47
|
-
result
|
48
|
-
end
|
49
|
-
# rubocop:enable all
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
require 'mocha/integration/assertion_counter'
|
2
|
-
require 'mocha/integration/monkey_patcher'
|
3
|
-
require 'mocha/integration/mini_test/exception_translation'
|
4
|
-
|
5
|
-
module Mocha
|
6
|
-
module Integration
|
7
|
-
module MiniTest
|
8
|
-
module Version140
|
9
|
-
def self.applicable_to?(mini_test_version)
|
10
|
-
Gem::Requirement.new('1.4.0').satisfied_by?(mini_test_version)
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.description
|
14
|
-
'monkey patch for MiniTest gem v1.4.0'
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.included(mod)
|
18
|
-
MonkeyPatcher.apply(mod, RunMethodPatch)
|
19
|
-
end
|
20
|
-
|
21
|
-
module RunMethodPatch
|
22
|
-
# rubocop:disable all
|
23
|
-
def run runner
|
24
|
-
assertion_counter = AssertionCounter.new(self)
|
25
|
-
result = '.'
|
26
|
-
begin
|
27
|
-
begin
|
28
|
-
@passed = nil
|
29
|
-
mocha_setup
|
30
|
-
self.setup
|
31
|
-
self.__send__ self.__name__
|
32
|
-
mocha_verify(assertion_counter)
|
33
|
-
@passed = true
|
34
|
-
rescue Exception => e
|
35
|
-
@passed = false
|
36
|
-
result = runner.puke(self.class, self.__name__, Mocha::Integration::MiniTest.translate(e))
|
37
|
-
ensure
|
38
|
-
begin
|
39
|
-
self.teardown
|
40
|
-
rescue Exception => e
|
41
|
-
result = runner.puke(self.class, self.__name__, Mocha::Integration::MiniTest.translate(e))
|
42
|
-
end
|
43
|
-
end
|
44
|
-
ensure
|
45
|
-
mocha_teardown
|
46
|
-
end
|
47
|
-
result
|
48
|
-
end
|
49
|
-
# rubocop:enable all
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
require 'mocha/integration/assertion_counter'
|
2
|
-
require 'mocha/integration/monkey_patcher'
|
3
|
-
require 'mocha/integration/mini_test/exception_translation'
|
4
|
-
|
5
|
-
module Mocha
|
6
|
-
module Integration
|
7
|
-
module MiniTest
|
8
|
-
module Version141
|
9
|
-
def self.applicable_to?(mini_test_version)
|
10
|
-
Gem::Requirement.new('1.4.1').satisfied_by?(mini_test_version)
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.description
|
14
|
-
'monkey patch for MiniTest gem v1.4.1'
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.included(mod)
|
18
|
-
MonkeyPatcher.apply(mod, RunMethodPatch)
|
19
|
-
end
|
20
|
-
|
21
|
-
module RunMethodPatch
|
22
|
-
# rubocop:disable all
|
23
|
-
def run runner
|
24
|
-
trap 'INFO' do
|
25
|
-
warn '%s#%s %.2fs' % [self.class, self.__name__,
|
26
|
-
(Time.now - runner.start_time)]
|
27
|
-
runner.status $stderr
|
28
|
-
end
|
29
|
-
|
30
|
-
assertion_counter = AssertionCounter.new(self)
|
31
|
-
result = '.'
|
32
|
-
begin
|
33
|
-
begin
|
34
|
-
@passed = nil
|
35
|
-
mocha_setup
|
36
|
-
self.setup
|
37
|
-
self.__send__ self.__name__
|
38
|
-
mocha_verify(assertion_counter)
|
39
|
-
@passed = true
|
40
|
-
rescue *::MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS
|
41
|
-
raise
|
42
|
-
rescue Exception => e
|
43
|
-
@passed = false
|
44
|
-
result = runner.puke(self.class, self.__name__, Mocha::Integration::MiniTest.translate(e))
|
45
|
-
ensure
|
46
|
-
begin
|
47
|
-
self.teardown
|
48
|
-
rescue *::MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS
|
49
|
-
raise
|
50
|
-
rescue Exception => e
|
51
|
-
result = runner.puke(self.class, self.__name__, Mocha::Integration::MiniTest.translate(e))
|
52
|
-
end
|
53
|
-
trap 'INFO', 'DEFAULT'
|
54
|
-
end
|
55
|
-
ensure
|
56
|
-
mocha_teardown
|
57
|
-
end
|
58
|
-
result
|
59
|
-
end
|
60
|
-
# rubocop:enable all
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
require 'mocha/integration/assertion_counter'
|
2
|
-
require 'mocha/integration/monkey_patcher'
|
3
|
-
require 'mocha/integration/mini_test/exception_translation'
|
4
|
-
|
5
|
-
module Mocha
|
6
|
-
module Integration
|
7
|
-
module MiniTest
|
8
|
-
module Version142To172
|
9
|
-
def self.applicable_to?(mini_test_version)
|
10
|
-
Gem::Requirement.new('>= 1.4.2', '<= 1.7.2').satisfied_by?(mini_test_version)
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.description
|
14
|
-
'monkey patch for MiniTest gem >= v1.4.2 and <= v1.7.2'
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.included(mod)
|
18
|
-
MonkeyPatcher.apply(mod, RunMethodPatch)
|
19
|
-
end
|
20
|
-
|
21
|
-
module RunMethodPatch
|
22
|
-
# rubocop:disable all
|
23
|
-
def run runner
|
24
|
-
trap 'INFO' do
|
25
|
-
warn '%s#%s %.2fs' % [self.class, self.__name__,
|
26
|
-
(Time.now - runner.start_time)]
|
27
|
-
runner.status $stderr
|
28
|
-
end if ::MiniTest::Unit::TestCase::SUPPORTS_INFO_SIGNAL
|
29
|
-
|
30
|
-
assertion_counter = AssertionCounter.new(self)
|
31
|
-
result = '.'
|
32
|
-
begin
|
33
|
-
begin
|
34
|
-
@passed = nil
|
35
|
-
mocha_setup
|
36
|
-
self.setup
|
37
|
-
self.__send__ self.__name__
|
38
|
-
mocha_verify(assertion_counter)
|
39
|
-
@passed = true
|
40
|
-
rescue *::MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS
|
41
|
-
raise
|
42
|
-
rescue Exception => e
|
43
|
-
@passed = false
|
44
|
-
result = runner.puke(self.class, self.__name__, Mocha::Integration::MiniTest.translate(e))
|
45
|
-
ensure
|
46
|
-
begin
|
47
|
-
self.teardown
|
48
|
-
rescue *::MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS
|
49
|
-
raise
|
50
|
-
rescue Exception => e
|
51
|
-
result = runner.puke(self.class, self.__name__, Mocha::Integration::MiniTest.translate(e))
|
52
|
-
end
|
53
|
-
trap 'INFO', 'DEFAULT' if ::MiniTest::Unit::TestCase::SUPPORTS_INFO_SIGNAL
|
54
|
-
end
|
55
|
-
ensure
|
56
|
-
mocha_teardown
|
57
|
-
end
|
58
|
-
result
|
59
|
-
end
|
60
|
-
# rubocop:enable all
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
@@ -1,66 +0,0 @@
|
|
1
|
-
require 'mocha/integration/assertion_counter'
|
2
|
-
require 'mocha/integration/monkey_patcher'
|
3
|
-
require 'mocha/integration/mini_test/exception_translation'
|
4
|
-
|
5
|
-
module Mocha
|
6
|
-
module Integration
|
7
|
-
module MiniTest
|
8
|
-
module Version200
|
9
|
-
def self.applicable_to?(mini_test_version)
|
10
|
-
Gem::Requirement.new('2.0.0').satisfied_by?(mini_test_version)
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.description
|
14
|
-
'monkey patch for MiniTest gem v2.0.0'
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.included(mod)
|
18
|
-
MonkeyPatcher.apply(mod, RunMethodPatch)
|
19
|
-
end
|
20
|
-
|
21
|
-
module RunMethodPatch
|
22
|
-
# rubocop:disable all
|
23
|
-
def run runner
|
24
|
-
trap 'INFO' do
|
25
|
-
time = Time.now - runner.start_time
|
26
|
-
warn "%s#%s %.2fs" % [self.class, self.__name__, time]
|
27
|
-
runner.status $stderr
|
28
|
-
end if ::MiniTest::Unit::TestCase::SUPPORTS_INFO_SIGNAL
|
29
|
-
|
30
|
-
assertion_counter = AssertionCounter.new(self)
|
31
|
-
result = ""
|
32
|
-
begin
|
33
|
-
begin
|
34
|
-
@passed = nil
|
35
|
-
mocha_setup
|
36
|
-
self.setup
|
37
|
-
self.__send__ self.__name__
|
38
|
-
mocha_verify(assertion_counter)
|
39
|
-
result = "." unless io?
|
40
|
-
@passed = true
|
41
|
-
rescue *::MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS
|
42
|
-
raise
|
43
|
-
rescue Exception => e
|
44
|
-
@passed = false
|
45
|
-
result = runner.puke self.class, self.__name__, Mocha::Integration::MiniTest.translate(e)
|
46
|
-
ensure
|
47
|
-
begin
|
48
|
-
self.teardown
|
49
|
-
rescue *::MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS
|
50
|
-
raise
|
51
|
-
rescue Exception => e
|
52
|
-
result = runner.puke self.class, self.__name__, Mocha::Integration::MiniTest.translate(e)
|
53
|
-
end
|
54
|
-
trap 'INFO', 'DEFAULT' if ::MiniTest::Unit::TestCase::SUPPORTS_INFO_SIGNAL
|
55
|
-
end
|
56
|
-
ensure
|
57
|
-
mocha_teardown
|
58
|
-
end
|
59
|
-
result
|
60
|
-
end
|
61
|
-
# rubocop:enable all
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
@@ -1,66 +0,0 @@
|
|
1
|
-
require 'mocha/integration/assertion_counter'
|
2
|
-
require 'mocha/integration/monkey_patcher'
|
3
|
-
require 'mocha/integration/mini_test/exception_translation'
|
4
|
-
|
5
|
-
module Mocha
|
6
|
-
module Integration
|
7
|
-
module MiniTest
|
8
|
-
module Version201To222
|
9
|
-
def self.applicable_to?(mini_test_version)
|
10
|
-
Gem::Requirement.new('>= 2.0.1', '<= 2.2.2').satisfied_by?(mini_test_version)
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.description
|
14
|
-
'monkey patch for MiniTest gem >= v2.0.1 <= v2.2.2'
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.included(mod)
|
18
|
-
MonkeyPatcher.apply(mod, RunMethodPatch)
|
19
|
-
end
|
20
|
-
|
21
|
-
module RunMethodPatch
|
22
|
-
# rubocop:disable all
|
23
|
-
def run runner
|
24
|
-
trap 'INFO' do
|
25
|
-
time = runner.start_time ? Time.now - runner.start_time : 0
|
26
|
-
warn "%s#%s %.2fs" % [self.class, self.__name__, time]
|
27
|
-
runner.status $stderr
|
28
|
-
end if ::MiniTest::Unit::TestCase::SUPPORTS_INFO_SIGNAL
|
29
|
-
|
30
|
-
assertion_counter = AssertionCounter.new(self)
|
31
|
-
result = ""
|
32
|
-
begin
|
33
|
-
begin
|
34
|
-
@passed = nil
|
35
|
-
mocha_setup
|
36
|
-
self.setup
|
37
|
-
self.__send__ self.__name__
|
38
|
-
mocha_verify(assertion_counter)
|
39
|
-
result = "." unless io?
|
40
|
-
@passed = true
|
41
|
-
rescue *::MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS
|
42
|
-
raise
|
43
|
-
rescue Exception => e
|
44
|
-
@passed = false
|
45
|
-
result = runner.puke self.class, self.__name__, Mocha::Integration::MiniTest.translate(e)
|
46
|
-
ensure
|
47
|
-
begin
|
48
|
-
self.teardown
|
49
|
-
rescue *::MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS
|
50
|
-
raise
|
51
|
-
rescue Exception => e
|
52
|
-
result = runner.puke self.class, self.__name__, Mocha::Integration::MiniTest.translate(e)
|
53
|
-
end
|
54
|
-
trap 'INFO', 'DEFAULT' if ::MiniTest::Unit::TestCase::SUPPORTS_INFO_SIGNAL
|
55
|
-
end
|
56
|
-
ensure
|
57
|
-
mocha_teardown
|
58
|
-
end
|
59
|
-
result
|
60
|
-
end
|
61
|
-
# rubocop:enable all
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'mocha/integration/assertion_counter'
|
2
|
-
require 'mocha/integration/monkey_patcher'
|
3
|
-
require 'mocha/integration/mini_test/exception_translation'
|
4
|
-
|
5
|
-
module Mocha
|
6
|
-
module Integration
|
7
|
-
module MiniTest
|
8
|
-
module Version2110To2111
|
9
|
-
def self.applicable_to?(mini_test_version)
|
10
|
-
Gem::Requirement.new('>= 2.11.0', '<= 2.11.1').satisfied_by?(mini_test_version)
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.description
|
14
|
-
'monkey patch for MiniTest gem >= v2.11.0 <= v2.11.1'
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.included(mod)
|
18
|
-
MonkeyPatcher.apply(mod, RunMethodPatch)
|
19
|
-
end
|
20
|
-
|
21
|
-
module RunMethodPatch
|
22
|
-
# rubocop:disable all
|
23
|
-
def run runner
|
24
|
-
trap 'INFO' do
|
25
|
-
time = runner.start_time ? Time.now - runner.start_time : 0
|
26
|
-
warn "%s#%s %.2fs" % [self.class, self.__name__, time]
|
27
|
-
runner.status $stderr
|
28
|
-
end if ::MiniTest::Unit::TestCase::SUPPORTS_INFO_SIGNAL
|
29
|
-
|
30
|
-
assertion_counter = AssertionCounter.new(self)
|
31
|
-
result = ""
|
32
|
-
begin
|
33
|
-
begin
|
34
|
-
@passed = nil
|
35
|
-
self.before_setup
|
36
|
-
mocha_setup
|
37
|
-
self.setup
|
38
|
-
self.after_setup
|
39
|
-
self.run_test self.__name__
|
40
|
-
mocha_verify(assertion_counter)
|
41
|
-
result = "." unless io?
|
42
|
-
@passed = true
|
43
|
-
rescue *::MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS
|
44
|
-
raise
|
45
|
-
rescue Exception => e
|
46
|
-
@passed = false
|
47
|
-
result = runner.puke self.class, self.__name__, Mocha::Integration::MiniTest.translate(e)
|
48
|
-
ensure
|
49
|
-
%w{ before_teardown teardown after_teardown }.each do |hook|
|
50
|
-
begin
|
51
|
-
self.send hook
|
52
|
-
rescue *::MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS
|
53
|
-
raise
|
54
|
-
rescue Exception => e
|
55
|
-
result = runner.puke self.class, self.__name__, Mocha::Integration::MiniTest.translate(e)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
trap 'INFO', 'DEFAULT' if ::MiniTest::Unit::TestCase::SUPPORTS_INFO_SIGNAL
|
59
|
-
end
|
60
|
-
ensure
|
61
|
-
mocha_teardown
|
62
|
-
end
|
63
|
-
result
|
64
|
-
end
|
65
|
-
# rubocop:enable all
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,73 +0,0 @@
|
|
1
|
-
require 'mocha/integration/assertion_counter'
|
2
|
-
require 'mocha/integration/monkey_patcher'
|
3
|
-
require 'mocha/integration/mini_test/exception_translation'
|
4
|
-
|
5
|
-
module Mocha
|
6
|
-
module Integration
|
7
|
-
module MiniTest
|
8
|
-
module Version2112To320
|
9
|
-
def self.applicable_to?(mini_test_version)
|
10
|
-
Gem::Requirement.new('>= 2.11.2', '<= 3.2.0').satisfied_by?(mini_test_version)
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.description
|
14
|
-
'monkey patch for MiniTest gem >= v2.11.2 <= v3.2.0'
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.included(mod)
|
18
|
-
MonkeyPatcher.apply(mod, RunMethodPatch)
|
19
|
-
end
|
20
|
-
|
21
|
-
module RunMethodPatch
|
22
|
-
# rubocop:disable all
|
23
|
-
def run runner
|
24
|
-
trap "INFO" do
|
25
|
-
runner.report.each_with_index do |msg, i|
|
26
|
-
warn "\n%3d) %s" % [i + 1, msg]
|
27
|
-
end
|
28
|
-
warn ''
|
29
|
-
time = runner.start_time ? Time.now - runner.start_time : 0
|
30
|
-
warn "Current Test: %s#%s %.2fs" % [self.class, self.__name__, time]
|
31
|
-
runner.status $stderr
|
32
|
-
end if ::MiniTest::Unit::TestCase::SUPPORTS_INFO_SIGNAL
|
33
|
-
assertion_counter = AssertionCounter.new(self)
|
34
|
-
result = ""
|
35
|
-
begin
|
36
|
-
begin
|
37
|
-
@passed = nil
|
38
|
-
self.before_setup
|
39
|
-
mocha_setup
|
40
|
-
self.setup
|
41
|
-
self.after_setup
|
42
|
-
self.run_test self.__name__
|
43
|
-
mocha_verify(assertion_counter)
|
44
|
-
result = "." unless io?
|
45
|
-
@passed = true
|
46
|
-
rescue *::MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS
|
47
|
-
raise
|
48
|
-
rescue Exception => e
|
49
|
-
@passed = false
|
50
|
-
result = runner.puke self.class, self.__name__, Mocha::Integration::MiniTest.translate(e)
|
51
|
-
ensure
|
52
|
-
%w{ before_teardown teardown after_teardown }.each do |hook|
|
53
|
-
begin
|
54
|
-
self.send hook
|
55
|
-
rescue *::MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS
|
56
|
-
raise
|
57
|
-
rescue Exception => e
|
58
|
-
result = runner.puke self.class, self.__name__, Mocha::Integration::MiniTest.translate(e)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
trap 'INFO', 'DEFAULT' if ::MiniTest::Unit::TestCase::SUPPORTS_INFO_SIGNAL
|
62
|
-
end
|
63
|
-
ensure
|
64
|
-
mocha_teardown
|
65
|
-
end
|
66
|
-
result
|
67
|
-
end
|
68
|
-
# rubocop:enable all
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|