mocha 1.15.0 → 2.0.0.alpha.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 +4 -4
- data/.rubocop.yml +5 -1
- data/Gemfile +3 -3
- data/RELEASE.md +42 -0
- data/Rakefile +12 -7
- data/lib/mocha/api.rb +5 -65
- data/lib/mocha/configuration.rb +30 -108
- data/lib/mocha/expectation.rb +62 -7
- data/lib/mocha/inspect.rb +2 -2
- 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 -31
- data/lib/mocha/invocation.rb +2 -15
- data/lib/mocha/minitest.rb +1 -4
- data/lib/mocha/mock.rb +13 -9
- data/lib/mocha/parameter_matchers/base.rb +1 -1
- data/lib/mocha/parameter_matchers/equivalent_uri.rb +0 -1
- data/lib/mocha/parameter_matchers/instance_methods.rb +10 -1
- data/lib/mocha/parameter_matchers/positional_or_keyword_hash.rb +64 -0
- data/lib/mocha/parameters_matcher.rb +3 -3
- data/lib/mocha/ruby_version.rb +1 -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 +1 -1
- metadata +10 -28
- 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_186_and_above.rb +0 -63
- data/lib/mocha/integration.rb +0 -11
- data/lib/mocha/setup.rb +0 -14
@@ -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
|
@@ -1,68 +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 Version230To2101
|
9
|
-
def self.applicable_to?(mini_test_version)
|
10
|
-
Gem::Requirement.new('>= 2.3.0', '<= 2.10.1').satisfied_by?(mini_test_version)
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.description
|
14
|
-
'monkey patch for MiniTest gem >= v2.3.0 <= v2.10.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
|
-
mocha_setup
|
36
|
-
self.setup
|
37
|
-
self.run_setup_hooks
|
38
|
-
self.__send__ self.__name__
|
39
|
-
mocha_verify(assertion_counter)
|
40
|
-
result = "." unless io?
|
41
|
-
@passed = true
|
42
|
-
rescue *::MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS
|
43
|
-
raise
|
44
|
-
rescue Exception => e
|
45
|
-
@passed = false
|
46
|
-
result = runner.puke self.class, self.__name__, Mocha::Integration::MiniTest.translate(e)
|
47
|
-
ensure
|
48
|
-
begin
|
49
|
-
self.run_teardown_hooks
|
50
|
-
self.teardown
|
51
|
-
rescue *::MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS
|
52
|
-
raise
|
53
|
-
rescue Exception => e
|
54
|
-
result = runner.puke self.class, self.__name__, Mocha::Integration::MiniTest.translate(e)
|
55
|
-
end
|
56
|
-
trap 'INFO', 'DEFAULT' if ::MiniTest::Unit::TestCase::SUPPORTS_INFO_SIGNAL
|
57
|
-
end
|
58
|
-
ensure
|
59
|
-
mocha_teardown
|
60
|
-
end
|
61
|
-
result
|
62
|
-
end
|
63
|
-
# rubocop:enable all
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
require 'mocha/integration/assertion_counter'
|
2
|
-
require 'mocha/integration/monkey_patcher'
|
3
|
-
require 'mocha/expectation_error'
|
4
|
-
|
5
|
-
module Mocha
|
6
|
-
module Integration
|
7
|
-
module TestUnit
|
8
|
-
module GemVersion200
|
9
|
-
def self.applicable_to?(test_unit_version, _ruby_version = nil)
|
10
|
-
Gem::Requirement.new('2.0.0').satisfied_by?(test_unit_version)
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.description
|
14
|
-
'monkey patch for Test::Unit 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(result)
|
24
|
-
assertion_counter = AssertionCounter.new(self)
|
25
|
-
begin
|
26
|
-
@_result = result
|
27
|
-
yield(Test::Unit::TestCase::STARTED, name)
|
28
|
-
begin
|
29
|
-
begin
|
30
|
-
mocha_setup
|
31
|
-
run_setup
|
32
|
-
__send__(@method_name)
|
33
|
-
mocha_verify(assertion_counter)
|
34
|
-
rescue Mocha::ExpectationError => e
|
35
|
-
add_failure(e.message, e.backtrace)
|
36
|
-
rescue Exception
|
37
|
-
@interrupted = true
|
38
|
-
raise unless handle_exception($!)
|
39
|
-
ensure
|
40
|
-
begin
|
41
|
-
run_teardown
|
42
|
-
rescue Mocha::ExpectationError => e
|
43
|
-
add_failure(e.message, e.backtrace)
|
44
|
-
rescue Exception
|
45
|
-
raise unless handle_exception($!)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
ensure
|
49
|
-
mocha_teardown
|
50
|
-
end
|
51
|
-
result.add_run
|
52
|
-
yield(Test::Unit::TestCase::FINISHED, name)
|
53
|
-
ensure
|
54
|
-
@_result = nil
|
55
|
-
end
|
56
|
-
end
|
57
|
-
# rubocop:enable all
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
require 'mocha/integration/assertion_counter'
|
2
|
-
require 'mocha/integration/monkey_patcher'
|
3
|
-
require 'mocha/expectation_error'
|
4
|
-
|
5
|
-
module Mocha
|
6
|
-
module Integration
|
7
|
-
module TestUnit
|
8
|
-
module GemVersion201To202
|
9
|
-
def self.applicable_to?(test_unit_version, _ruby_version = nil)
|
10
|
-
Gem::Requirement.new('>= 2.0.1', '<= 2.0.2').satisfied_by?(test_unit_version)
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.description
|
14
|
-
'monkey patch for Test::Unit gem >= v2.0.1 and <= v2.0.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(result)
|
24
|
-
assertion_counter = AssertionCounter.new(self)
|
25
|
-
begin
|
26
|
-
@_result = result
|
27
|
-
yield(Test::Unit::TestCase::STARTED, name)
|
28
|
-
begin
|
29
|
-
begin
|
30
|
-
mocha_setup
|
31
|
-
run_setup
|
32
|
-
run_test
|
33
|
-
mocha_verify(assertion_counter)
|
34
|
-
rescue Mocha::ExpectationError => e
|
35
|
-
add_failure(e.message, e.backtrace)
|
36
|
-
rescue Exception
|
37
|
-
@interrupted = true
|
38
|
-
raise unless handle_exception($!)
|
39
|
-
ensure
|
40
|
-
begin
|
41
|
-
run_teardown
|
42
|
-
rescue Mocha::ExpectationError => e
|
43
|
-
add_failure(e.message, e.backtrace)
|
44
|
-
rescue Exception
|
45
|
-
raise unless handle_exception($!)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
ensure
|
49
|
-
mocha_teardown
|
50
|
-
end
|
51
|
-
result.add_run
|
52
|
-
yield(Test::Unit::TestCase::FINISHED, name)
|
53
|
-
ensure
|
54
|
-
@_result = nil
|
55
|
-
end
|
56
|
-
end
|
57
|
-
# rubocop:enable all
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
require 'mocha/integration/assertion_counter'
|
2
|
-
require 'mocha/integration/monkey_patcher'
|
3
|
-
require 'mocha/expectation_error'
|
4
|
-
|
5
|
-
module Mocha
|
6
|
-
module Integration
|
7
|
-
module TestUnit
|
8
|
-
module GemVersion203To220
|
9
|
-
def self.applicable_to?(test_unit_version, _ruby_version = nil)
|
10
|
-
Gem::Requirement.new('>= 2.0.3', '<= 2.2.0').satisfied_by?(test_unit_version)
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.description
|
14
|
-
'monkey patch for Test::Unit gem >= v2.0.3 and <= v2.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(result)
|
24
|
-
assertion_counter = AssertionCounter.new(self)
|
25
|
-
begin
|
26
|
-
@_result = result
|
27
|
-
yield(Test::Unit::TestCase::STARTED, name)
|
28
|
-
begin
|
29
|
-
begin
|
30
|
-
mocha_setup
|
31
|
-
run_setup
|
32
|
-
run_test
|
33
|
-
mocha_verify(assertion_counter)
|
34
|
-
rescue Mocha::ExpectationError => e
|
35
|
-
add_failure(e.message, e.backtrace)
|
36
|
-
rescue Exception
|
37
|
-
@interrupted = true
|
38
|
-
raise unless handle_exception($!)
|
39
|
-
ensure
|
40
|
-
begin
|
41
|
-
run_teardown
|
42
|
-
rescue Mocha::ExpectationError => e
|
43
|
-
add_failure(e.message, e.backtrace)
|
44
|
-
rescue Exception
|
45
|
-
raise unless handle_exception($!)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
ensure
|
49
|
-
mocha_teardown
|
50
|
-
end
|
51
|
-
result.add_run
|
52
|
-
yield(Test::Unit::TestCase::FINISHED, name)
|
53
|
-
ensure
|
54
|
-
# @_result = nil # For test-spec's after_all :<
|
55
|
-
end
|
56
|
-
end
|
57
|
-
# rubocop:enable all
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|