mocha 1.16.1 → 2.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +10 -13
- data/.yardopts +1 -2
- data/COPYING.md +2 -2
- data/Gemfile +7 -4
- data/MIT-LICENSE.md +1 -1
- data/README.md +23 -24
- data/RELEASE.md +294 -0
- data/Rakefile +23 -24
- data/lib/mocha/api.rb +30 -71
- data/lib/mocha/backtrace_filter.rb +2 -2
- data/lib/mocha/cardinality.rb +4 -0
- data/lib/mocha/configuration.rb +44 -126
- data/lib/mocha/debug.rb +2 -5
- data/lib/mocha/detection/{mini_test.rb → minitest.rb} +5 -5
- data/lib/mocha/detection/test_unit.rb +2 -2
- data/lib/mocha/expectation.rb +99 -12
- data/lib/mocha/expectation_error_factory.rb +2 -2
- data/lib/mocha/expectation_list.rb +8 -6
- data/lib/mocha/hooks.rb +10 -4
- data/lib/mocha/inspect.rb +15 -4
- data/lib/mocha/integration/{mini_test → minitest}/adapter.rb +21 -6
- data/lib/mocha/integration/{mini_test → minitest}/exception_translation.rb +2 -2
- data/lib/mocha/integration/minitest.rb +28 -0
- data/lib/mocha/integration/test_unit/adapter.rb +9 -4
- data/lib/mocha/integration/test_unit.rb +10 -31
- data/lib/mocha/invocation.rb +2 -15
- data/lib/mocha/minitest.rb +3 -6
- data/lib/mocha/mock.rb +45 -18
- data/lib/mocha/mockery.rb +13 -9
- data/lib/mocha/names.rb +1 -1
- data/lib/mocha/object_methods.rb +2 -2
- data/lib/mocha/parameter_matchers/base.rb +4 -9
- data/lib/mocha/parameter_matchers/equivalent_uri.rb +1 -2
- data/lib/mocha/parameter_matchers/has_entries.rb +7 -2
- data/lib/mocha/parameter_matchers/includes.rb +3 -3
- data/lib/mocha/parameter_matchers/instance_methods.rb +10 -2
- data/lib/mocha/parameter_matchers/positional_or_keyword_hash.rb +66 -0
- data/lib/mocha/parameter_matchers/responds_with.rb +32 -5
- data/lib/mocha/parameters_matcher.rb +10 -6
- data/lib/mocha/ruby_version.rb +2 -9
- data/lib/mocha/stubbed_method.rb +3 -39
- data/lib/mocha/test_unit.rb +1 -4
- data/lib/mocha/version.rb +1 -1
- data/mocha.gemspec +11 -1
- metadata +31 -31
- 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/mini_test.rb +0 -56
- 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_186_and_above.rb +0 -63
- data/lib/mocha/integration.rb +0 -11
- data/lib/mocha/setup.rb +0 -14
- data/yard-templates/default/layout/html/google_analytics.erb +0 -8
- data/yard-templates/default/layout/html/setup.rb +0 -5
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mocha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Mead
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
11
|
+
date: 2024-12-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ruby2_keywords
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.0.5
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.0.5
|
13
27
|
description: Mocking and stubbing library with JMock/SchMock syntax, which allows
|
14
28
|
mocking and stubbing of methods on real (non-mock) classes.
|
15
29
|
email: mocha-developer@googlegroups.com
|
@@ -31,7 +45,6 @@ files:
|
|
31
45
|
- Rakefile
|
32
46
|
- gemfiles/Gemfile.minitest.latest
|
33
47
|
- gemfiles/Gemfile.test-unit.latest
|
34
|
-
- init.rb
|
35
48
|
- lib/mocha.rb
|
36
49
|
- lib/mocha/any_instance_method.rb
|
37
50
|
- lib/mocha/api.rb
|
@@ -45,7 +58,7 @@ files:
|
|
45
58
|
- lib/mocha/configuration.rb
|
46
59
|
- lib/mocha/debug.rb
|
47
60
|
- lib/mocha/deprecation.rb
|
48
|
-
- lib/mocha/detection/
|
61
|
+
- lib/mocha/detection/minitest.rb
|
49
62
|
- lib/mocha/detection/test_unit.rb
|
50
63
|
- lib/mocha/error_with_filtered_backtrace.rb
|
51
64
|
- lib/mocha/exception_raiser.rb
|
@@ -57,30 +70,13 @@ files:
|
|
57
70
|
- lib/mocha/in_state_ordering_constraint.rb
|
58
71
|
- lib/mocha/inspect.rb
|
59
72
|
- lib/mocha/instance_method.rb
|
60
|
-
- lib/mocha/integration.rb
|
61
73
|
- lib/mocha/integration/assertion_counter.rb
|
62
|
-
- lib/mocha/integration/
|
63
|
-
- lib/mocha/integration/
|
64
|
-
- lib/mocha/integration/
|
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
|
74
|
+
- lib/mocha/integration/minitest.rb
|
75
|
+
- lib/mocha/integration/minitest/adapter.rb
|
76
|
+
- lib/mocha/integration/minitest/exception_translation.rb
|
75
77
|
- lib/mocha/integration/monkey_patcher.rb
|
76
78
|
- lib/mocha/integration/test_unit.rb
|
77
79
|
- 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_186_and_above.rb
|
84
80
|
- lib/mocha/invocation.rb
|
85
81
|
- lib/mocha/is_a.rb
|
86
82
|
- lib/mocha/logger.rb
|
@@ -112,6 +108,7 @@ files:
|
|
112
108
|
- lib/mocha/parameter_matchers/kind_of.rb
|
113
109
|
- lib/mocha/parameter_matchers/not.rb
|
114
110
|
- lib/mocha/parameter_matchers/optionally.rb
|
111
|
+
- lib/mocha/parameter_matchers/positional_or_keyword_hash.rb
|
115
112
|
- lib/mocha/parameter_matchers/regexp_matches.rb
|
116
113
|
- lib/mocha/parameter_matchers/responds_with.rb
|
117
114
|
- lib/mocha/parameter_matchers/yaml_equivalent.rb
|
@@ -121,7 +118,6 @@ files:
|
|
121
118
|
- lib/mocha/return_values.rb
|
122
119
|
- lib/mocha/ruby_version.rb
|
123
120
|
- lib/mocha/sequence.rb
|
124
|
-
- lib/mocha/setup.rb
|
125
121
|
- lib/mocha/single_return_value.rb
|
126
122
|
- lib/mocha/state_machine.rb
|
127
123
|
- lib/mocha/stubbed_method.rb
|
@@ -132,13 +128,17 @@ files:
|
|
132
128
|
- lib/mocha/version.rb
|
133
129
|
- lib/mocha/yield_parameters.rb
|
134
130
|
- mocha.gemspec
|
135
|
-
- yard-templates/default/layout/html/google_analytics.erb
|
136
|
-
- yard-templates/default/layout/html/setup.rb
|
137
131
|
homepage: https://mocha.jamesmead.org
|
138
132
|
licenses:
|
139
133
|
- MIT
|
140
134
|
- BSD-2-Clause
|
141
|
-
metadata:
|
135
|
+
metadata:
|
136
|
+
bug_tracker_uri: https://github.com/freerange/mocha/issues
|
137
|
+
changelog_uri: https://github.com/freerange/mocha/blob/main/RELEASE.md
|
138
|
+
documentation_uri: https://mocha.jamesmead.org/
|
139
|
+
funding_uri: https://github.com/sponsors/floehopper
|
140
|
+
homepage_uri: https://mocha.jamesmead.org
|
141
|
+
source_code_uri: https://github.com/freerange/mocha
|
142
142
|
post_install_message:
|
143
143
|
rdoc_options: []
|
144
144
|
require_paths:
|
@@ -147,14 +147,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
147
147
|
requirements:
|
148
148
|
- - ">="
|
149
149
|
- !ruby/object:Gem::Version
|
150
|
-
version: '1
|
150
|
+
version: '2.1'
|
151
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
152
|
requirements:
|
153
153
|
- - ">="
|
154
154
|
- !ruby/object:Gem::Version
|
155
155
|
version: '0'
|
156
156
|
requirements: []
|
157
|
-
rubygems_version: 3.
|
157
|
+
rubygems_version: 3.5.22
|
158
158
|
signing_key:
|
159
159
|
specification_version: 4
|
160
160
|
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
|