mocha 0.12.8 → 0.13.0
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.
- data/.yardopts +22 -0
- data/COPYING.md +3 -0
- data/README.md +230 -0
- data/{RELEASE.rdoc → RELEASE.md} +61 -50
- data/Rakefile +45 -37
- data/build-matrix.rb +16 -4
- data/lib/mocha/api.rb +13 -16
- data/lib/mocha/class_method.rb +7 -3
- data/lib/mocha/class_methods.rb +63 -0
- data/lib/mocha/debug.rb +11 -0
- data/lib/mocha/deprecation.rb +1 -1
- data/lib/mocha/exception_raiser.rb +1 -1
- data/lib/mocha/expectation_error.rb +5 -0
- data/lib/mocha/expectation_error_factory.rb +19 -0
- data/lib/mocha/hooks.rb +43 -0
- data/lib/mocha/integration/assertion_counter.rb +13 -0
- data/lib/mocha/integration/mini_test/adapter.rb +54 -0
- data/lib/mocha/integration/mini_test/exception_translation.rb +0 -6
- data/lib/mocha/integration/mini_test/nothing.rb +19 -0
- data/lib/mocha/integration/mini_test/version_13.rb +32 -25
- data/lib/mocha/integration/mini_test/version_140.rb +32 -26
- data/lib/mocha/integration/mini_test/version_141.rb +40 -34
- data/lib/mocha/integration/mini_test/version_142_to_172.rb +40 -34
- data/lib/mocha/integration/mini_test/version_200.rb +41 -35
- data/lib/mocha/integration/mini_test/version_201_to_222.rb +41 -35
- data/lib/mocha/integration/mini_test/version_2110_to_2111.rb +49 -43
- data/lib/mocha/integration/mini_test/version_2112_to_320.rb +53 -47
- data/lib/mocha/integration/mini_test/version_230_to_2101.rb +43 -37
- data/lib/mocha/integration/mini_test.rb +42 -57
- data/lib/mocha/integration/monkey_patcher.rb +18 -0
- data/lib/mocha/integration/test_unit/adapter.rb +51 -0
- data/lib/mocha/integration/test_unit/gem_version_200.rb +36 -29
- data/lib/mocha/integration/test_unit/gem_version_201_to_202.rb +36 -29
- data/lib/mocha/integration/test_unit/gem_version_203_to_220.rb +36 -29
- data/lib/mocha/integration/test_unit/gem_version_230_to_250.rb +65 -0
- data/lib/mocha/integration/test_unit/nothing.rb +19 -0
- data/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb +36 -29
- data/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb +37 -30
- data/lib/mocha/integration/test_unit.rb +38 -45
- data/lib/mocha/integration.rb +6 -38
- data/lib/mocha/method_matcher.rb +1 -1
- data/lib/mocha/module_methods.rb +14 -0
- data/lib/mocha/{object.rb → object_methods.rb} +0 -83
- data/lib/mocha/setup.rb +10 -0
- data/lib/mocha/standalone.rb +3 -0
- data/lib/mocha/version.rb +1 -1
- data/lib/mocha.rb +6 -2
- data/lib/mocha_standalone.rb +3 -1
- data/mocha.gemspec +16 -9
- data/test/acceptance/bug_18914_test.rb +1 -1
- data/test/acceptance/bug_21465_test.rb +1 -1
- data/test/acceptance/bug_21563_test.rb +1 -1
- data/test/acceptance/exception_rescue_test.rb +1 -1
- data/test/acceptance/expectations_on_multiple_methods_test.rb +1 -1
- data/test/acceptance/expected_invocation_count_test.rb +1 -1
- data/test/acceptance/failure_messages_test.rb +1 -1
- data/test/acceptance/issue_65_test.rb +1 -1
- data/test/acceptance/issue_70_test.rb +1 -1
- data/test/acceptance/mocha_example_test.rb +1 -1
- data/test/acceptance/mocha_test_result_test.rb +1 -1
- data/test/acceptance/mock_test.rb +1 -1
- data/test/acceptance/mock_with_initializer_block_test.rb +1 -1
- data/test/acceptance/mocked_methods_dispatch_test.rb +1 -1
- data/test/acceptance/multiple_expectations_failure_message_test.rb +1 -1
- data/test/acceptance/optional_parameters_test.rb +1 -1
- data/test/acceptance/parameter_matcher_test.rb +1 -1
- data/test/acceptance/partial_mocks_test.rb +1 -1
- data/test/acceptance/raise_exception_test.rb +1 -1
- data/test/acceptance/return_value_test.rb +1 -1
- data/test/acceptance/sequence_test.rb +1 -1
- data/test/acceptance/states_test.rb +1 -1
- data/test/acceptance/stub_any_instance_method_test.rb +1 -1
- data/test/acceptance/stub_class_method_defined_on_active_record_association_proxy_test.rb +1 -1
- data/test/acceptance/stub_class_method_defined_on_class_test.rb +1 -1
- data/test/acceptance/stub_class_method_defined_on_module_test.rb +1 -1
- data/test/acceptance/stub_class_method_defined_on_superclass_test.rb +1 -1
- data/test/acceptance/stub_everything_test.rb +1 -1
- data/test/acceptance/stub_instance_method_defined_on_active_record_association_proxy_test.rb +1 -1
- data/test/acceptance/stub_instance_method_defined_on_class_and_aliased_test.rb +1 -1
- data/test/acceptance/stub_instance_method_defined_on_class_test.rb +1 -1
- data/test/acceptance/stub_instance_method_defined_on_kernel_module_test.rb +1 -1
- data/test/acceptance/stub_instance_method_defined_on_module_test.rb +1 -1
- data/test/acceptance/stub_instance_method_defined_on_object_class_test.rb +1 -1
- data/test/acceptance/stub_instance_method_defined_on_singleton_class_test.rb +1 -1
- data/test/acceptance/stub_instance_method_defined_on_superclass_test.rb +1 -1
- data/test/acceptance/stub_module_method_test.rb +1 -1
- data/test/acceptance/stub_test.rb +1 -1
- data/test/acceptance/stubba_example_test.rb +1 -1
- data/test/acceptance/stubba_test_result_test.rb +1 -1
- data/test/acceptance/stubbing_error_backtrace_test.rb +1 -1
- data/test/acceptance/stubbing_frozen_object_test.rb +1 -1
- data/test/acceptance/stubbing_method_accepting_block_parameter_test.rb +1 -1
- data/test/acceptance/stubbing_method_unnecessarily_test.rb +1 -1
- data/test/acceptance/stubbing_nil_test.rb +1 -1
- data/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +1 -1
- data/test/acceptance/stubbing_non_existent_class_method_test.rb +1 -1
- data/test/acceptance/stubbing_non_existent_instance_method_test.rb +1 -1
- data/test/acceptance/stubbing_non_public_any_instance_method_test.rb +1 -1
- data/test/acceptance/stubbing_non_public_class_method_test.rb +1 -1
- data/test/acceptance/stubbing_non_public_instance_method_test.rb +1 -1
- data/test/acceptance/stubbing_on_non_mock_object_test.rb +1 -1
- data/test/acceptance/stubbing_same_class_method_on_parent_and_child_classes_test.rb +3 -3
- data/test/acceptance/throw_test.rb +1 -1
- data/test/acceptance/unstubbing_test.rb +1 -1
- data/test/integration/mini_test_test.rb +9 -0
- data/test/integration/shared_tests.rb +174 -0
- data/test/integration/test_unit_test.rb +9 -0
- data/test/mini_test_result.rb +0 -1
- data/test/test_runner.rb +14 -14
- data/test/unit/class_methods_test.rb +40 -0
- data/test/unit/method_matcher_test.rb +5 -0
- data/test/unit/mock_test.rb +6 -0
- data/test/unit/module_methods_test.rb +19 -0
- data/test/unit/object_methods_test.rb +45 -0
- metadata +44 -72
- data/COPYING.rdoc +0 -3
- data/README.rdoc +0 -56
- data/examples/misc.rb +0 -43
- data/examples/mocha.rb +0 -25
- data/examples/stubba.rb +0 -64
- data/gemfiles/Gemfile.minitest.3.3.0 +0 -7
- data/gemfiles/Gemfile.minitest.4.2.0 +0 -7
- data/lib/mocha/integration/mini_test/assertion_counter.rb +0 -23
- data/lib/mocha/integration/mini_test/version_330_to_410.rb +0 -65
- data/lib/mocha/integration/mini_test/version_420_to_433.rb +0 -70
- data/lib/mocha/integration/mini_test/version_440.rb +0 -70
- data/lib/mocha/integration/test_unit/assertion_counter.rb +0 -23
- data/lib/mocha/integration/test_unit/gem_version_230_to_253.rb +0 -58
- data/lib/mocha/options.rb +0 -1
- data/test/acceptance/api_test.rb +0 -139
- data/test/acceptance/minitest_test.rb +0 -162
- data/test/unit/object_test.rb +0 -92
- /data/{MIT-LICENSE.rdoc → MIT-LICENSE.md} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require File.expand_path('../acceptance_test_helper', __FILE__)
|
|
2
|
-
require 'mocha'
|
|
2
|
+
require 'mocha/setup'
|
|
3
3
|
|
|
4
4
|
class StubbingSameClassMethodOnParentAndChildClassTest < Test::Unit::TestCase
|
|
5
5
|
|
|
@@ -21,11 +21,11 @@ class StubbingSameClassMethodOnParentAndChildClassTest < Test::Unit::TestCase
|
|
|
21
21
|
end
|
|
22
22
|
child_class = Class.new(parent_class)
|
|
23
23
|
test_result = run_as_tests(
|
|
24
|
-
lambda {
|
|
24
|
+
:test_1 => lambda {
|
|
25
25
|
parent_class.stubs(:foo).returns("stubbed Parent.foo")
|
|
26
26
|
child_class.stubs(:foo).returns("stubbed Child.foo")
|
|
27
27
|
},
|
|
28
|
-
lambda {
|
|
28
|
+
:test_2 => lambda {
|
|
29
29
|
parent_class.foo
|
|
30
30
|
child_class.foo
|
|
31
31
|
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
require 'test_runner'
|
|
2
|
+
require 'execution_point'
|
|
3
|
+
|
|
4
|
+
module SharedTests
|
|
5
|
+
include TestRunner
|
|
6
|
+
|
|
7
|
+
def test_assertion_satisfied
|
|
8
|
+
test_result = run_as_test do
|
|
9
|
+
assert true
|
|
10
|
+
end
|
|
11
|
+
assert_passed(test_result)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def test_assertion_unsatisfied
|
|
15
|
+
execution_point = nil
|
|
16
|
+
test_result = run_as_test do
|
|
17
|
+
execution_point = ExecutionPoint.current; flunk
|
|
18
|
+
end
|
|
19
|
+
assert_failed(test_result)
|
|
20
|
+
failure = test_result.failures.first
|
|
21
|
+
assert_equal execution_point, ExecutionPoint.new(failure.location)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def test_mock_object_unexpected_invocation
|
|
25
|
+
execution_point = nil
|
|
26
|
+
test_result = run_as_test do
|
|
27
|
+
mock = mock("not expecting invocation")
|
|
28
|
+
execution_point = ExecutionPoint.current; mock.unexpected
|
|
29
|
+
end
|
|
30
|
+
assert_failed(test_result)
|
|
31
|
+
failure = test_result.failures.first
|
|
32
|
+
assert_equal execution_point, ExecutionPoint.new(failure.location)
|
|
33
|
+
assert_equal ["unexpected invocation: #<Mock:not expecting invocation>.unexpected()"], test_result.failure_message_lines
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def test_mock_object_explicitly_unexpected_invocation
|
|
37
|
+
execution_point = nil
|
|
38
|
+
test_result = run_as_test do
|
|
39
|
+
mock = mock("not expecting invocation")
|
|
40
|
+
mock.expects(:unexpected).never
|
|
41
|
+
execution_point = ExecutionPoint.current; mock.unexpected
|
|
42
|
+
end
|
|
43
|
+
assert_failed(test_result)
|
|
44
|
+
failure = test_result.failures.first
|
|
45
|
+
assert_equal execution_point, ExecutionPoint.new(failure.location)
|
|
46
|
+
assert_equal [
|
|
47
|
+
"unexpected invocation: #<Mock:not expecting invocation>.unexpected()",
|
|
48
|
+
"unsatisfied expectations:",
|
|
49
|
+
"- expected never, invoked once: #<Mock:not expecting invocation>.unexpected(any_parameters)"
|
|
50
|
+
], test_result.failure_message_lines
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def test_mock_object_unsatisfied_expectation
|
|
54
|
+
execution_point = nil
|
|
55
|
+
test_result = run_as_test do
|
|
56
|
+
mock = mock("expecting invocation")
|
|
57
|
+
execution_point = ExecutionPoint.current; mock.expects(:expected)
|
|
58
|
+
end
|
|
59
|
+
assert_failed(test_result)
|
|
60
|
+
failure = test_result.failures.first
|
|
61
|
+
assert_equal execution_point, ExecutionPoint.new(failure.location)
|
|
62
|
+
assert_equal [
|
|
63
|
+
"not all expectations were satisfied",
|
|
64
|
+
"unsatisfied expectations:",
|
|
65
|
+
"- expected exactly once, not yet invoked: #<Mock:expecting invocation>.expected(any_parameters)"
|
|
66
|
+
], test_result.failure_message_lines
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def test_mock_object_unexpected_invocation_in_setup
|
|
70
|
+
execution_point = nil
|
|
71
|
+
test_result = run_as_tests(
|
|
72
|
+
:setup => lambda {
|
|
73
|
+
mock = mock("not expecting invocation")
|
|
74
|
+
execution_point = ExecutionPoint.current; mock.unexpected
|
|
75
|
+
},
|
|
76
|
+
:test_me => lambda {
|
|
77
|
+
assert true
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
assert_failed(test_result)
|
|
81
|
+
failure = test_result.failures.first
|
|
82
|
+
assert_equal execution_point, ExecutionPoint.new(failure.location)
|
|
83
|
+
assert_equal ["unexpected invocation: #<Mock:not expecting invocation>.unexpected()"], test_result.failure_message_lines
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def test_mock_object_unsatisfied_expectation_in_setup
|
|
87
|
+
execution_point = nil
|
|
88
|
+
test_result = run_as_tests(
|
|
89
|
+
:setup => lambda {
|
|
90
|
+
mock = mock("expecting invocation")
|
|
91
|
+
execution_point = ExecutionPoint.current; mock.expects(:expected)
|
|
92
|
+
},
|
|
93
|
+
:test_me => lambda {
|
|
94
|
+
assert true
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
assert_failed(test_result)
|
|
98
|
+
failure = test_result.failures.first
|
|
99
|
+
assert_equal execution_point, ExecutionPoint.new(failure.location)
|
|
100
|
+
assert_equal [
|
|
101
|
+
"not all expectations were satisfied",
|
|
102
|
+
"unsatisfied expectations:",
|
|
103
|
+
"- expected exactly once, not yet invoked: #<Mock:expecting invocation>.expected(any_parameters)"
|
|
104
|
+
], test_result.failure_message_lines
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def test_mock_object_unexpected_invocation_in_teardown
|
|
108
|
+
execution_point = nil
|
|
109
|
+
test_result = run_as_tests(
|
|
110
|
+
:test_me => lambda {
|
|
111
|
+
assert true
|
|
112
|
+
},
|
|
113
|
+
:teardown => lambda {
|
|
114
|
+
mock = mock("not expecting invocation")
|
|
115
|
+
execution_point = ExecutionPoint.current; mock.unexpected
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
assert_failed(test_result)
|
|
119
|
+
failure = test_result.failures.first
|
|
120
|
+
assert_equal execution_point, ExecutionPoint.new(failure.location)
|
|
121
|
+
assert_equal ["unexpected invocation: #<Mock:not expecting invocation>.unexpected()"], test_result.failure_message_lines
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def test_real_object_explicitly_unexpected_invocation
|
|
125
|
+
execution_point = nil
|
|
126
|
+
object = Object.new
|
|
127
|
+
test_result = run_as_test do
|
|
128
|
+
object.expects(:unexpected).never
|
|
129
|
+
execution_point = ExecutionPoint.current; object.unexpected
|
|
130
|
+
end
|
|
131
|
+
assert_failed(test_result)
|
|
132
|
+
failure = test_result.failures.first
|
|
133
|
+
assert_equal execution_point, ExecutionPoint.new(failure.location)
|
|
134
|
+
assert_equal [
|
|
135
|
+
"unexpected invocation: #{object.mocha_inspect}.unexpected()",
|
|
136
|
+
"unsatisfied expectations:",
|
|
137
|
+
"- expected never, invoked once: #{object.mocha_inspect}.unexpected(any_parameters)"
|
|
138
|
+
], test_result.failure_message_lines
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
def test_real_object_unsatisfied_expectation
|
|
142
|
+
execution_point = nil
|
|
143
|
+
object = Object.new
|
|
144
|
+
test_result = run_as_test do
|
|
145
|
+
execution_point = ExecutionPoint.current; object.expects(:expected)
|
|
146
|
+
end
|
|
147
|
+
assert_failed(test_result)
|
|
148
|
+
failure = test_result.failures.first
|
|
149
|
+
assert_equal execution_point, ExecutionPoint.new(failure.location)
|
|
150
|
+
assert_equal [
|
|
151
|
+
"not all expectations were satisfied",
|
|
152
|
+
"unsatisfied expectations:",
|
|
153
|
+
"- expected exactly once, not yet invoked: #{object.mocha_inspect}.expected(any_parameters)"
|
|
154
|
+
], test_result.failure_message_lines
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def test_real_object_expectation_does_not_leak_into_subsequent_test
|
|
158
|
+
execution_point = nil
|
|
159
|
+
klass = Class.new
|
|
160
|
+
test_result = run_as_tests(
|
|
161
|
+
:test_1 => lambda {
|
|
162
|
+
klass.expects(:foo)
|
|
163
|
+
klass.foo
|
|
164
|
+
},
|
|
165
|
+
:test_2 => lambda {
|
|
166
|
+
execution_point = ExecutionPoint.current; klass.foo
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
assert_failed(test_result)
|
|
170
|
+
exception = test_result.errors.first.exception
|
|
171
|
+
assert_equal execution_point, ExecutionPoint.new(exception.backtrace)
|
|
172
|
+
assert_match %r{undefined method `foo'}, exception.message
|
|
173
|
+
end
|
|
174
|
+
end
|
data/test/mini_test_result.rb
CHANGED
data/test/test_runner.rb
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
require 'test/unit/testcase'
|
|
2
2
|
|
|
3
3
|
if defined?(MiniTest)
|
|
4
|
-
require 'mocha/integration/mini_test'
|
|
5
4
|
require File.expand_path('../mini_test_result', __FILE__)
|
|
6
5
|
else
|
|
7
6
|
require File.expand_path('../test_unit_result', __FILE__)
|
|
@@ -9,28 +8,29 @@ end
|
|
|
9
8
|
|
|
10
9
|
module TestRunner
|
|
11
10
|
def run_as_test(&block)
|
|
12
|
-
run_as_tests(block)
|
|
11
|
+
run_as_tests(:test_me => block)
|
|
13
12
|
end
|
|
14
13
|
|
|
15
|
-
def run_as_tests(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
def run_as_tests(methods = {})
|
|
15
|
+
base_class = defined?(MiniTest) ? MiniTest::Unit::TestCase : Test::Unit::TestCase
|
|
16
|
+
test_class = Class.new(base_class) do
|
|
17
|
+
methods.each do |(method_name, proc)|
|
|
18
|
+
define_method(method_name, proc)
|
|
19
19
|
end
|
|
20
|
-
test_class.new(:test_me)
|
|
21
20
|
end
|
|
21
|
+
tests = methods.keys.select { |m| m.to_s[/^test/] }.map { |m| test_class.new(m) }
|
|
22
22
|
|
|
23
|
-
if defined?(
|
|
24
|
-
test_result = TestUnitResult.build_test_result
|
|
25
|
-
tests.each do |test|
|
|
26
|
-
test.run(test_result) {}
|
|
27
|
-
end
|
|
28
|
-
else
|
|
23
|
+
if defined?(MiniTest)
|
|
29
24
|
runner = MiniTest::Unit.new
|
|
30
25
|
tests.each do |test|
|
|
31
26
|
test.run(runner)
|
|
32
27
|
end
|
|
33
28
|
test_result = MiniTestResult.new(runner, tests)
|
|
29
|
+
else
|
|
30
|
+
test_result = TestUnitResult.build_test_result
|
|
31
|
+
tests.each do |test|
|
|
32
|
+
test.run(test_result) {}
|
|
33
|
+
end
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
test_result
|
|
@@ -42,7 +42,7 @@ module TestRunner
|
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
def assert_failed(test_result)
|
|
45
|
-
flunk "Test passed unexpectedly"
|
|
45
|
+
flunk "Test passed unexpectedly" unless test_result.failure_count + test_result.error_count > 0
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require File.expand_path('../../test_helper', __FILE__)
|
|
2
|
+
require 'mocha/class_methods'
|
|
3
|
+
require 'mocha/object_methods'
|
|
4
|
+
|
|
5
|
+
class ClassMethodsTest < Test::Unit::TestCase
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
@klass = Class.new.extend(Mocha::ClassMethods, Mocha::ObjectMethods)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def test_should_build_any_instance_object
|
|
12
|
+
any_instance = @klass.any_instance
|
|
13
|
+
assert_not_nil any_instance
|
|
14
|
+
assert any_instance.is_a?(Mocha::ClassMethods::AnyInstance)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def test_should_return_same_any_instance_object
|
|
18
|
+
any_instance_1 = @klass.any_instance
|
|
19
|
+
any_instance_2 = @klass.any_instance
|
|
20
|
+
assert_equal any_instance_1, any_instance_2
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def test_should_use_stubba_class_method_for_class
|
|
24
|
+
assert_equal Mocha::ClassMethod, @klass.stubba_method
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def test_should_use_stubba_class_method_for_any_instance
|
|
28
|
+
assert_equal Mocha::AnyInstanceMethod, @klass.any_instance.stubba_method
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def test_should_stub_self_for_class
|
|
32
|
+
assert_equal @klass, @klass.stubba_object
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def test_should_stub_relevant_class_for_any_instance
|
|
36
|
+
any_instance = @klass.any_instance
|
|
37
|
+
assert_equal @klass, any_instance.stubba_object
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|
|
@@ -10,6 +10,11 @@ class MethodMatcherTest < Test::Unit::TestCase
|
|
|
10
10
|
assert method_matcher.match?(:method_name)
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
+
def test_should_match_if_actual_method_name_is_expected_method_name_as_string
|
|
14
|
+
method_matcher = MethodMatcher.new(:method_name)
|
|
15
|
+
assert method_matcher.match?('method_name')
|
|
16
|
+
end
|
|
17
|
+
|
|
13
18
|
def test_should_not_match_if_actual_method_name_is_not_same_as_expected_method_name
|
|
14
19
|
method_matcher = MethodMatcher.new(:method_name)
|
|
15
20
|
assert !method_matcher.match?(:different_method_name)
|