mocha-macruby 0.9.8.20100129120100 → 0.9.9.20101102121900

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. data/COPYING.rdoc +3 -0
  2. data/{MIT-LICENSE → MIT-LICENSE.rdoc} +0 -0
  3. data/{README → README.rdoc} +7 -7
  4. data/{RELEASE → RELEASE.rdoc} +18 -0
  5. data/Rakefile +44 -28
  6. data/lib/mocha.rb +1 -0
  7. data/lib/mocha/class_method.rb +1 -3
  8. data/lib/mocha/expectation.rb +37 -34
  9. data/lib/mocha/integration/mini_test.rb +32 -4
  10. data/lib/mocha/integration/mini_test/exception_translation.rb +20 -0
  11. data/lib/mocha/integration/mini_test/{version_131_and_above.rb → version_13.rb} +7 -13
  12. data/lib/mocha/integration/mini_test/version_140.rb +52 -0
  13. data/lib/mocha/integration/mini_test/version_141.rb +56 -0
  14. data/lib/mocha/integration/mini_test/version_142_and_above.rb +47 -0
  15. data/lib/mocha/integration/test_unit.rb +23 -8
  16. data/lib/mocha/integration/test_unit/gem_version_200.rb +3 -0
  17. data/lib/mocha/integration/test_unit/{gem_version_201_and_above.rb → gem_version_201_to_202.rb} +4 -1
  18. data/lib/mocha/integration/test_unit/gem_version_203_to_209.rb +52 -0
  19. data/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb +3 -0
  20. data/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb +3 -0
  21. data/lib/mocha/mock.rb +33 -18
  22. data/lib/mocha/module_method.rb +1 -1
  23. data/lib/mocha/object.rb +144 -160
  24. data/lib/mocha/options.rb +1 -0
  25. data/lib/mocha/parameter_matchers/base.rb +50 -2
  26. data/test/acceptance/acceptance_test_helper.rb +1 -1
  27. data/test/acceptance/api_test.rb +1 -1
  28. data/test/acceptance/bug_18914_test.rb +1 -1
  29. data/test/acceptance/bug_21465_test.rb +1 -1
  30. data/test/acceptance/bug_21563_test.rb +1 -1
  31. data/test/acceptance/expected_invocation_count_test.rb +1 -1
  32. data/test/acceptance/failure_messages_test.rb +1 -1
  33. data/test/acceptance/minitest_test.rb +128 -124
  34. data/test/acceptance/mocha_example_test.rb +1 -1
  35. data/test/acceptance/mocha_test_result_test.rb +1 -1
  36. data/test/acceptance/mock_test.rb +1 -1
  37. data/test/acceptance/mock_with_initializer_block_test.rb +1 -1
  38. data/test/acceptance/mocked_methods_dispatch_test.rb +1 -1
  39. data/test/acceptance/optional_parameters_test.rb +1 -1
  40. data/test/acceptance/parameter_matcher_test.rb +38 -1
  41. data/test/acceptance/partial_mocks_test.rb +1 -1
  42. data/test/acceptance/return_value_test.rb +1 -1
  43. data/test/acceptance/sequence_test.rb +1 -1
  44. data/test/acceptance/states_test.rb +1 -1
  45. data/test/acceptance/stub_any_instance_method_test.rb +5 -2
  46. data/test/acceptance/stub_class_method_test.rb +5 -2
  47. data/test/acceptance/stub_everything_test.rb +1 -1
  48. data/test/acceptance/stub_instance_method_test.rb +5 -2
  49. data/test/acceptance/stub_module_method_test.rb +3 -3
  50. data/test/acceptance/stub_test.rb +1 -1
  51. data/test/acceptance/stubba_example_test.rb +1 -1
  52. data/test/acceptance/stubba_test.rb +1 -1
  53. data/test/acceptance/stubba_test_result_test.rb +1 -1
  54. data/test/acceptance/stubbing_error_backtrace_test.rb +1 -1
  55. data/test/acceptance/stubbing_method_unnecessarily_test.rb +1 -1
  56. data/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +5 -5
  57. data/test/acceptance/stubbing_non_existent_class_method_test.rb +5 -5
  58. data/test/acceptance/stubbing_non_existent_instance_method_test.rb +5 -5
  59. data/test/acceptance/stubbing_non_public_any_instance_method_test.rb +9 -9
  60. data/test/acceptance/stubbing_non_public_class_method_test.rb +9 -9
  61. data/test/acceptance/stubbing_non_public_instance_method_test.rb +9 -9
  62. data/test/acceptance/stubbing_on_non_mock_object_test.rb +5 -5
  63. data/test/mini_test_result.rb +74 -0
  64. data/test/test_helper.rb +3 -1
  65. data/test/test_runner.rb +25 -11
  66. data/test/unit/any_instance_method_test.rb +1 -1
  67. data/test/unit/array_inspect_test.rb +1 -1
  68. data/test/unit/backtrace_filter_test.rb +1 -1
  69. data/test/unit/cardinality_test.rb +1 -1
  70. data/test/unit/central_test.rb +1 -1
  71. data/test/unit/change_state_side_effect_test.rb +1 -1
  72. data/test/unit/class_method_test.rb +2 -2
  73. data/test/unit/configuration_test.rb +1 -1
  74. data/test/unit/date_time_inspect_test.rb +1 -1
  75. data/test/unit/exception_raiser_test.rb +1 -1
  76. data/test/unit/expectation_list_test.rb +1 -1
  77. data/test/unit/expectation_test.rb +1 -1
  78. data/test/unit/hash_inspect_test.rb +1 -1
  79. data/test/unit/in_state_ordering_constraint_test.rb +1 -1
  80. data/test/unit/metaclass_test.rb +1 -1
  81. data/test/unit/method_matcher_test.rb +1 -1
  82. data/test/unit/mock_test.rb +16 -14
  83. data/test/unit/mockery_test.rb +1 -1
  84. data/test/unit/multiple_yields_test.rb +1 -1
  85. data/test/unit/no_yields_test.rb +1 -1
  86. data/test/unit/object_inspect_test.rb +10 -9
  87. data/test/unit/object_test.rb +11 -10
  88. data/test/unit/parameter_matchers/all_of_test.rb +1 -1
  89. data/test/unit/parameter_matchers/any_of_test.rb +1 -1
  90. data/test/unit/parameter_matchers/anything_test.rb +1 -1
  91. data/test/unit/parameter_matchers/equals_test.rb +1 -1
  92. data/test/unit/parameter_matchers/has_entries_test.rb +1 -1
  93. data/test/unit/parameter_matchers/has_entry_test.rb +1 -1
  94. data/test/unit/parameter_matchers/has_key_test.rb +1 -1
  95. data/test/unit/parameter_matchers/has_value_test.rb +1 -1
  96. data/test/unit/parameter_matchers/includes_test.rb +5 -5
  97. data/test/unit/parameter_matchers/instance_of_test.rb +2 -2
  98. data/test/unit/parameter_matchers/is_a_test.rb +1 -1
  99. data/test/unit/parameter_matchers/kind_of_test.rb +1 -1
  100. data/test/unit/parameter_matchers/not_test.rb +1 -1
  101. data/test/unit/parameter_matchers/regexp_matches_test.rb +1 -1
  102. data/test/unit/parameter_matchers/responds_with_test.rb +1 -1
  103. data/test/unit/parameter_matchers/yaml_equivalent_test.rb +1 -1
  104. data/test/unit/parameters_matcher_test.rb +1 -1
  105. data/test/unit/return_values_test.rb +1 -1
  106. data/test/unit/sequence_test.rb +1 -1
  107. data/test/unit/single_return_value_test.rb +1 -1
  108. data/test/unit/single_yield_test.rb +1 -1
  109. data/test/unit/state_machine_test.rb +1 -1
  110. data/test/unit/string_inspect_test.rb +1 -1
  111. data/test/unit/yield_parameters_test.rb +1 -1
  112. metadata +43 -19
  113. data/COPYING +0 -3
@@ -1,153 +1,157 @@
1
- require File.join(File.dirname(__FILE__), "acceptance_test_helper")
1
+ require File.expand_path('../acceptance_test_helper', __FILE__)
2
2
 
3
- begin
4
- require 'rubygems'
5
- gem 'minitest'
6
- rescue Gem::LoadError
7
- # MiniTest gem not available
8
- end
3
+ if defined?(MiniTest)
4
+ $stderr.puts "TODO: Running suite with MiniTest, running the MiniTestAdapterTest results in an error so skipping it for now."
5
+ else
6
+ begin
7
+ require 'rubygems'
8
+ gem 'minitest'
9
+ rescue Gem::LoadError
10
+ # MiniTest gem not available
11
+ end
9
12
 
10
- begin
11
- require 'minitest/unit'
12
- rescue LoadError
13
- # MiniTest not available
14
- end
13
+ begin
14
+ require 'minitest/unit'
15
+ rescue LoadError
16
+ # MiniTest not available
17
+ end
15
18
 
16
- if defined?(MiniTest)
19
+ if defined?(MiniTest)
17
20
 
18
- # monkey-patch MiniTest now that it has hopefully been loaded
19
- require 'mocha/integration/mini_test'
21
+ # monkey-patch MiniTest now that it has hopefully been loaded
22
+ require 'mocha/integration/mini_test'
20
23
 
21
- class MiniTestSampleTest < MiniTest::Unit::TestCase
22
-
23
- def test_mocha_with_fulfilled_expectation
24
- mockee = mock()
25
- mockee.expects(:blah)
26
- mockee.blah
27
- end
28
-
29
- def test_mocha_with_unfulfilled_expectation
30
- mockee = mock()
31
- mockee.expects(:blah)
32
- end
24
+ class MiniTestSampleTest < MiniTest::Unit::TestCase
25
+
26
+ def test_mocha_with_fulfilled_expectation
27
+ mockee = mock()
28
+ mockee.expects(:blah)
29
+ mockee.blah
30
+ end
31
+
32
+ def test_mocha_with_unfulfilled_expectation
33
+ mockee = mock()
34
+ mockee.expects(:blah)
35
+ end
36
+
37
+ def test_mocha_with_unexpected_invocation
38
+ mockee = mock()
39
+ mockee.blah
40
+ end
41
+
42
+ def test_stubba_with_fulfilled_expectation
43
+ stubbee = Class.new { define_method(:blah) {} }.new
44
+ stubbee.expects(:blah)
45
+ stubbee.blah
46
+ end
47
+
48
+ def test_stubba_with_unfulfilled_expectation
49
+ stubbee = Class.new { define_method(:blah) {} }.new
50
+ stubbee.expects(:blah)
51
+ end
52
+
53
+ def test_mocha_with_matching_parameter
54
+ mockee = mock()
55
+ mockee.expects(:blah).with(has_key(:wibble))
56
+ mockee.blah(:wibble => 1)
57
+ end
58
+
59
+ def test_mocha_with_non_matching_parameter
60
+ mockee = mock()
61
+ mockee.expects(:blah).with(has_key(:wibble))
62
+ mockee.blah(:wobble => 2)
63
+ end
33
64
 
34
- def test_mocha_with_unexpected_invocation
35
- mockee = mock()
36
- mockee.blah
37
65
  end
38
-
39
- def test_stubba_with_fulfilled_expectation
40
- stubbee = Class.new { define_method(:blah) {} }.new
41
- stubbee.expects(:blah)
42
- stubbee.blah
43
- end
44
-
45
- def test_stubba_with_unfulfilled_expectation
46
- stubbee = Class.new { define_method(:blah) {} }.new
47
- stubbee.expects(:blah)
48
- end
49
-
50
- def test_mocha_with_matching_parameter
51
- mockee = mock()
52
- mockee.expects(:blah).with(has_key(:wibble))
53
- mockee.blah(:wibble => 1)
54
- end
55
-
56
- def test_mocha_with_non_matching_parameter
57
- mockee = mock()
58
- mockee.expects(:blah).with(has_key(:wibble))
59
- mockee.blah(:wobble => 2)
60
- end
61
-
62
- end
63
66
 
64
- class MiniTestTest < Test::Unit::TestCase
67
+ class MiniTestTest < Test::Unit::TestCase
65
68
 
66
- def setup
67
- @output = StringIO.new
68
- MiniTest::Unit.output = @output
69
- @runner = MiniTest::Unit.new
70
- end
69
+ def setup
70
+ @output = StringIO.new
71
+ MiniTest::Unit.output = @output
72
+ @runner = MiniTest::Unit.new
73
+ end
71
74
 
72
- attr_reader :runner
75
+ attr_reader :runner
73
76
 
74
- def test_should_pass_mocha_test
75
- runner.run(%w(-n test_mocha_with_fulfilled_expectation))
77
+ def test_should_pass_mocha_test
78
+ runner.run(%w(-n test_mocha_with_fulfilled_expectation))
76
79
 
77
- assert_equal 0, runner.failures
78
- assert_equal 0, runner.errors
79
- assert_equal 1, runner.assertion_count
80
- end
80
+ assert_equal 0, runner.failures
81
+ assert_equal 0, runner.errors
82
+ assert_equal 1, runner.assertion_count
83
+ end
81
84
 
82
- def test_should_fail_mocha_test_due_to_unfulfilled_expectation
83
- runner.run(%w(-n test_mocha_with_unfulfilled_expectation))
85
+ def test_should_fail_mocha_test_due_to_unfulfilled_expectation
86
+ runner.run(%w(-n test_mocha_with_unfulfilled_expectation))
84
87
 
85
- assert_equal 1, runner.failures
86
- assert_equal 0, runner.errors
87
- assert_equal 1, runner.assertion_count
88
- assert_not_all_expectation_were_satisfied
89
- end
90
-
91
- def test_should_fail_mocha_test_due_to_unexpected_invocation
92
- runner.run(%w(-n test_mocha_with_unexpected_invocation))
88
+ assert_equal 1, runner.failures
89
+ assert_equal 0, runner.errors
90
+ assert_equal 1, runner.assertion_count
91
+ assert_not_all_expectation_were_satisfied
92
+ end
93
+
94
+ def test_should_fail_mocha_test_due_to_unexpected_invocation
95
+ runner.run(%w(-n test_mocha_with_unexpected_invocation))
93
96
 
94
- assert_equal 1, runner.failures
95
- assert_equal 0, runner.errors
96
- assert_equal 0, runner.assertion_count
97
- assert_unexpected_invocation
98
- end
99
-
100
- def test_should_pass_stubba_test
101
- runner.run(%w(-n test_stubba_with_fulfilled_expectation))
97
+ assert_equal 1, runner.failures
98
+ assert_equal 0, runner.errors
99
+ assert_equal 0, runner.assertion_count
100
+ assert_unexpected_invocation
101
+ end
102
+
103
+ def test_should_pass_stubba_test
104
+ runner.run(%w(-n test_stubba_with_fulfilled_expectation))
102
105
 
103
- assert_equal 0, runner.failures
104
- assert_equal 0, runner.errors
105
- assert_equal 1, runner.assertion_count
106
- end
106
+ assert_equal 0, runner.failures
107
+ assert_equal 0, runner.errors
108
+ assert_equal 1, runner.assertion_count
109
+ end
107
110
 
108
- def test_should_fail_stubba_test_due_to_unfulfilled_expectation
109
- runner.run(%w(-n test_stubba_with_unfulfilled_expectation))
111
+ def test_should_fail_stubba_test_due_to_unfulfilled_expectation
112
+ runner.run(%w(-n test_stubba_with_unfulfilled_expectation))
110
113
 
111
- assert_equal 1, runner.failures
112
- assert_equal 0, runner.errors
113
- assert_equal 1, runner.assertion_count
114
- assert_not_all_expectation_were_satisfied
115
- end
116
-
117
- def test_should_pass_mocha_test_with_matching_parameter
118
- runner.run(%w(-n test_mocha_with_matching_parameter))
114
+ assert_equal 1, runner.failures
115
+ assert_equal 0, runner.errors
116
+ assert_equal 1, runner.assertion_count
117
+ assert_not_all_expectation_were_satisfied
118
+ end
119
+
120
+ def test_should_pass_mocha_test_with_matching_parameter
121
+ runner.run(%w(-n test_mocha_with_matching_parameter))
119
122
 
120
- assert_equal 0, runner.failures
121
- assert_equal 0, runner.errors
122
- assert_equal 1, runner.assertion_count
123
- end
123
+ assert_equal 0, runner.failures
124
+ assert_equal 0, runner.errors
125
+ assert_equal 1, runner.assertion_count
126
+ end
124
127
 
125
- def test_should_fail_mocha_test_with_non_matching_parameter
126
- runner.run(%w(-n test_mocha_with_non_matching_parameter))
128
+ def test_should_fail_mocha_test_with_non_matching_parameter
129
+ runner.run(%w(-n test_mocha_with_non_matching_parameter))
127
130
 
128
- assert_equal 1, runner.failures
129
- assert_equal 0, runner.errors
130
- assert_equal 0, runner.assertion_count # unexpected invocation occurs before expectation is verified
131
- assert_unexpected_invocation
132
- end
131
+ assert_equal 1, runner.failures
132
+ assert_equal 0, runner.errors
133
+ assert_equal 0, runner.assertion_count # unexpected invocation occurs before expectation is verified
134
+ assert_unexpected_invocation
135
+ end
133
136
 
134
- private
137
+ private
135
138
 
136
- def output
137
- @output.rewind
138
- @output.read
139
- end
139
+ def output
140
+ @output.rewind
141
+ @output.read
142
+ end
140
143
 
141
- def assert_unexpected_invocation
142
- assert_match Regexp.new('unexpected invocation'), output, "MiniTest output:\n#{output}"
143
- end
144
+ def assert_unexpected_invocation
145
+ assert_match Regexp.new('unexpected invocation'), output, "MiniTest output:\n#{output}"
146
+ end
147
+
148
+ def assert_not_all_expectation_were_satisfied
149
+ assert_match Regexp.new('not all expectations were satisfied'), output, "MiniTest output:\n#{output}"
150
+ end
144
151
 
145
- def assert_not_all_expectation_were_satisfied
146
- assert_match Regexp.new('not all expectations were satisfied'), output, "MiniTest output:\n#{output}"
147
152
  end
148
153
 
154
+ else
155
+ $stderr.puts "MiniTest is not available, so MiniTestAdapterTest has not been run."
149
156
  end
150
-
151
- else
152
- warn "MiniTest is not available, so MiniTestAdapterTest has not been run."
153
157
  end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), "..", "test_helper")
1
+ require File.expand_path('../../test_helper', __FILE__)
2
2
  require 'mocha'
3
3
 
4
4
  class MochaExampleTest < Test::Unit::TestCase
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), "acceptance_test_helper")
1
+ require File.expand_path('../acceptance_test_helper', __FILE__)
2
2
  require 'mocha'
3
3
  require 'execution_point'
4
4
 
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), "acceptance_test_helper")
1
+ require File.expand_path('../acceptance_test_helper', __FILE__)
2
2
  require 'mocha'
3
3
 
4
4
  class MockTest < Test::Unit::TestCase
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), "acceptance_test_helper")
1
+ require File.expand_path('../acceptance_test_helper', __FILE__)
2
2
  require 'mocha'
3
3
 
4
4
  class MockWithInitializerBlockTest < Test::Unit::TestCase
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), "acceptance_test_helper")
1
+ require File.expand_path('../acceptance_test_helper', __FILE__)
2
2
  require 'mocha'
3
3
 
4
4
  class MockedMethodDispatchTest < Test::Unit::TestCase
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), "acceptance_test_helper")
1
+ require File.expand_path('../acceptance_test_helper', __FILE__)
2
2
  require 'mocha'
3
3
 
4
4
  class OptionalParameterMatcherTest < Test::Unit::TestCase
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), "acceptance_test_helper")
1
+ require File.expand_path('../acceptance_test_helper', __FILE__)
2
2
  require 'mocha'
3
3
 
4
4
  class ParameterMatcherTest < Test::Unit::TestCase
@@ -157,6 +157,25 @@ class ParameterMatcherTest < Test::Unit::TestCase
157
157
  end
158
158
  assert_failed(test_result)
159
159
  end
160
+
161
+ def test_should_match_parameter_that_matches_any_of_the_given_matchers
162
+ test_result = run_as_test do
163
+ mock = mock()
164
+ mock.expects(:method).with(has_key(:foo) | has_key(:bar)).times(2)
165
+ mock.method(:foo => 'fooval')
166
+ mock.method(:bar => 'barval')
167
+ end
168
+ assert_passed(test_result)
169
+ end
170
+
171
+ def test_should_not_match_parameter_that_does_not_match_any_of_the_given_matchers
172
+ test_result = run_as_test do
173
+ mock = mock()
174
+ mock.expects(:method).with(has_key(:foo) | has_key(:bar))
175
+ mock.method(:baz => 'bazval')
176
+ end
177
+ assert_failed(test_result)
178
+ end
160
179
 
161
180
  def test_should_match_parameter_that_matches_all_values
162
181
  test_result = run_as_test do
@@ -175,6 +194,24 @@ class ParameterMatcherTest < Test::Unit::TestCase
175
194
  end
176
195
  assert_failed(test_result)
177
196
  end
197
+
198
+ def test_should_match_parameter_that_matches_all_matchers
199
+ test_result = run_as_test do
200
+ mock = mock()
201
+ mock.expects(:method).with(has_key(:foo) & has_key(:bar))
202
+ mock.method(:foo => 'fooval', :bar => 'barval')
203
+ end
204
+ assert_passed(test_result)
205
+ end
206
+
207
+ def test_should_not_match_parameter_that_does_not_match_all_matchers
208
+ test_result = run_as_test do
209
+ mock = mock()
210
+ mock.expects(:method).with(has_key(:foo) & has_key(:bar))
211
+ mock.method(:foo => 'fooval', :baz => 'bazval')
212
+ end
213
+ assert_failed(test_result)
214
+ end
178
215
 
179
216
  def test_should_match_parameter_that_responds_with_specified_value
180
217
  klass = Class.new do
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), "acceptance_test_helper")
1
+ require File.expand_path('../acceptance_test_helper', __FILE__)
2
2
  require 'mocha'
3
3
 
4
4
  class PartialMockTest < Test::Unit::TestCase
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), "acceptance_test_helper")
1
+ require File.expand_path('../acceptance_test_helper', __FILE__)
2
2
  require 'mocha'
3
3
 
4
4
  class ReturnValueTest < Test::Unit::TestCase
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), "acceptance_test_helper")
1
+ require File.expand_path('../acceptance_test_helper', __FILE__)
2
2
  require 'mocha'
3
3
 
4
4
  class SequenceTest < Test::Unit::TestCase
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), "acceptance_test_helper")
1
+ require File.expand_path('../acceptance_test_helper', __FILE__)
2
2
  require 'mocha'
3
3
 
4
4
  class StatesTest < Test::Unit::TestCase
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), "acceptance_test_helper")
1
+ require File.expand_path('../acceptance_test_helper', __FILE__)
2
2
  require 'mocha'
3
3
 
4
4
  class StubAnyInstanceMethodTest < Test::Unit::TestCase
@@ -47,13 +47,16 @@ class StubAnyInstanceMethodTest < Test::Unit::TestCase
47
47
  :original_return_value
48
48
  end
49
49
  protected :my_instance_method
50
+ def my_unprotected_instance_method
51
+ my_instance_method
52
+ end
50
53
  end
51
54
  instance = klass.new
52
55
  run_as_test do
53
56
  klass.any_instance.stubs(:my_instance_method).returns(:new_return_value)
54
57
  end
55
58
  assert instance.protected_methods(false).any? { |m| m.to_s == 'my_instance_method' }
56
- assert_equal :original_return_value, instance.send(:my_instance_method)
59
+ assert_equal :original_return_value, instance.my_unprotected_instance_method
57
60
  end
58
61
 
59
62
  def test_should_leave_stubbed_private_method_unchanged_after_test
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), "acceptance_test_helper")
1
+ require File.expand_path('../acceptance_test_helper', __FILE__)
2
2
  require 'mocha'
3
3
 
4
4
  class StubClassMethodTest < Test::Unit::TestCase
@@ -50,13 +50,16 @@ class StubClassMethodTest < Test::Unit::TestCase
50
50
  :original_return_value
51
51
  end
52
52
  protected :my_class_method
53
+ def my_unprotected_class_method
54
+ my_class_method
55
+ end
53
56
  end
54
57
  end
55
58
  run_as_test do
56
59
  klass.stubs(:my_class_method).returns(:new_return_value)
57
60
  end
58
61
  assert klass.protected_methods(false).any? { |m| m.to_s == 'my_class_method' }
59
- assert_equal :original_return_value, klass.send(:my_class_method)
62
+ assert_equal :original_return_value, klass.my_unprotected_class_method
60
63
  end
61
64
 
62
65
  def test_should_leave_stubbed_private_method_unchanged_after_test