jferris-mocha 0.9.7.20090911190113 → 0.9.8.20100526112143

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. data/README +3 -1
  2. data/RELEASE +7 -0
  3. data/Rakefile +3 -3
  4. data/lib/mocha/configuration.rb +29 -10
  5. data/lib/mocha/expectation.rb +5 -1
  6. data/lib/mocha/integration/mini_test.rb +27 -2
  7. data/lib/mocha/integration/mini_test/exception_translation.rb +20 -0
  8. data/lib/mocha/integration/mini_test/version_13.rb +44 -0
  9. data/lib/mocha/integration/mini_test/{version_131_and_above.rb → version_140.rb} +7 -12
  10. data/lib/mocha/integration/mini_test/version_141.rb +56 -0
  11. data/lib/mocha/integration/mini_test/version_142_and_above.rb +56 -0
  12. data/lib/mocha/integration/test_unit.rb +20 -7
  13. data/lib/mocha/integration/test_unit/gem_version_200.rb +3 -0
  14. data/lib/mocha/integration/test_unit/{gem_version_201_and_above.rb → gem_version_201_to_202.rb} +4 -1
  15. data/lib/mocha/integration/test_unit/gem_version_203_to_207.rb +52 -0
  16. data/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb +3 -0
  17. data/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb +3 -0
  18. data/lib/mocha/mock.rb +0 -1
  19. data/lib/mocha/module_method.rb +1 -1
  20. data/lib/mocha/parameter_matchers/base.rb +50 -2
  21. data/lib/mocha/parameter_matchers/has_key.rb +1 -0
  22. data/lib/mocha/parameter_matchers/has_value.rb +1 -0
  23. data/lib/mocha/parameter_matchers/includes.rb +1 -0
  24. data/lib/mocha/parameter_matchers/regexp_matches.rb +1 -0
  25. data/test/acceptance/acceptance_test_helper.rb +1 -1
  26. data/test/acceptance/api_test.rb +1 -1
  27. data/test/acceptance/bug_18914_test.rb +1 -1
  28. data/test/acceptance/bug_21465_test.rb +1 -1
  29. data/test/acceptance/bug_21563_test.rb +1 -1
  30. data/test/acceptance/expected_invocation_count_test.rb +1 -1
  31. data/test/acceptance/failure_messages_test.rb +1 -1
  32. data/test/acceptance/minitest_test.rb +128 -124
  33. data/test/acceptance/mocha_example_test.rb +1 -1
  34. data/test/acceptance/mocha_test_result_test.rb +1 -1
  35. data/test/acceptance/mock_test.rb +1 -1
  36. data/test/acceptance/mock_with_initializer_block_test.rb +1 -1
  37. data/test/acceptance/mocked_methods_dispatch_test.rb +1 -1
  38. data/test/acceptance/optional_parameters_test.rb +1 -1
  39. data/test/acceptance/parameter_matcher_test.rb +38 -1
  40. data/test/acceptance/partial_mocks_test.rb +1 -1
  41. data/test/acceptance/return_value_test.rb +1 -1
  42. data/test/acceptance/sequence_test.rb +1 -1
  43. data/test/acceptance/states_test.rb +1 -1
  44. data/test/acceptance/stub_any_instance_method_test.rb +5 -2
  45. data/test/acceptance/stub_class_method_test.rb +5 -2
  46. data/test/acceptance/stub_everything_test.rb +1 -1
  47. data/test/acceptance/stub_instance_method_test.rb +5 -2
  48. data/test/acceptance/stub_module_method_test.rb +3 -3
  49. data/test/acceptance/stub_test.rb +1 -1
  50. data/test/acceptance/stubba_example_test.rb +1 -1
  51. data/test/acceptance/stubba_test.rb +1 -1
  52. data/test/acceptance/stubba_test_result_test.rb +1 -1
  53. data/test/acceptance/stubbing_error_backtrace_test.rb +1 -1
  54. data/test/acceptance/stubbing_method_unnecessarily_test.rb +1 -1
  55. data/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +5 -5
  56. data/test/acceptance/stubbing_non_existent_class_method_test.rb +5 -5
  57. data/test/acceptance/stubbing_non_existent_instance_method_test.rb +5 -5
  58. data/test/acceptance/stubbing_non_public_any_instance_method_test.rb +9 -9
  59. data/test/acceptance/stubbing_non_public_class_method_test.rb +9 -9
  60. data/test/acceptance/stubbing_non_public_instance_method_test.rb +9 -9
  61. data/test/acceptance/stubbing_on_non_mock_object_test.rb +5 -5
  62. data/test/mini_test_result.rb +74 -0
  63. data/test/test_helper.rb +1 -0
  64. data/test/test_runner.rb +25 -11
  65. data/test/unit/any_instance_method_test.rb +1 -1
  66. data/test/unit/array_inspect_test.rb +1 -1
  67. data/test/unit/backtrace_filter_test.rb +1 -1
  68. data/test/unit/cardinality_test.rb +1 -1
  69. data/test/unit/central_test.rb +1 -1
  70. data/test/unit/change_state_side_effect_test.rb +1 -1
  71. data/test/unit/class_method_test.rb +1 -1
  72. data/test/unit/configuration_test.rb +38 -0
  73. data/test/unit/date_time_inspect_test.rb +1 -1
  74. data/test/unit/exception_raiser_test.rb +1 -1
  75. data/test/unit/expectation_list_test.rb +1 -1
  76. data/test/unit/expectation_test.rb +1 -1
  77. data/test/unit/hash_inspect_test.rb +1 -1
  78. data/test/unit/in_state_ordering_constraint_test.rb +1 -1
  79. data/test/unit/metaclass_test.rb +1 -1
  80. data/test/unit/method_matcher_test.rb +1 -1
  81. data/test/unit/mock_test.rb +1 -1
  82. data/test/unit/mockery_test.rb +1 -1
  83. data/test/unit/multiple_yields_test.rb +1 -1
  84. data/test/unit/no_yields_test.rb +1 -1
  85. data/test/unit/object_inspect_test.rb +9 -8
  86. data/test/unit/object_test.rb +1 -1
  87. data/test/unit/parameter_matchers/all_of_test.rb +1 -1
  88. data/test/unit/parameter_matchers/any_of_test.rb +1 -1
  89. data/test/unit/parameter_matchers/anything_test.rb +1 -1
  90. data/test/unit/parameter_matchers/equals_test.rb +1 -1
  91. data/test/unit/parameter_matchers/has_entries_test.rb +1 -1
  92. data/test/unit/parameter_matchers/has_entry_test.rb +1 -1
  93. data/test/unit/parameter_matchers/has_key_test.rb +20 -1
  94. data/test/unit/parameter_matchers/has_value_test.rb +21 -1
  95. data/test/unit/parameter_matchers/includes_test.rb +21 -2
  96. data/test/unit/parameter_matchers/instance_of_test.rb +1 -1
  97. data/test/unit/parameter_matchers/is_a_test.rb +1 -1
  98. data/test/unit/parameter_matchers/kind_of_test.rb +1 -1
  99. data/test/unit/parameter_matchers/not_test.rb +1 -1
  100. data/test/unit/parameter_matchers/regexp_matches_test.rb +22 -1
  101. data/test/unit/parameter_matchers/responds_with_test.rb +1 -1
  102. data/test/unit/parameter_matchers/yaml_equivalent_test.rb +1 -1
  103. data/test/unit/parameters_matcher_test.rb +1 -1
  104. data/test/unit/return_values_test.rb +1 -1
  105. data/test/unit/sequence_test.rb +1 -1
  106. data/test/unit/single_return_value_test.rb +1 -1
  107. data/test/unit/single_yield_test.rb +1 -1
  108. data/test/unit/state_machine_test.rb +1 -1
  109. data/test/unit/string_inspect_test.rb +1 -1
  110. data/test/unit/yield_parameters_test.rb +1 -1
  111. metadata +39 -13
@@ -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
@@ -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 StubEverythingTest < 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 StubInstanceMethodTest < Test::Unit::TestCase
@@ -32,12 +32,15 @@ class StubInstanceMethodTest < Test::Unit::TestCase
32
32
  :original_return_value
33
33
  end
34
34
  protected :my_instance_method
35
+ def my_unprotected_instance_method
36
+ my_instance_method
37
+ end
35
38
  end.new
36
39
  run_as_test do
37
40
  instance.stubs(:my_instance_method).returns(:new_return_value)
38
41
  end
39
42
  assert instance.protected_methods(false).any? { |m| m.to_s == 'my_instance_method' }
40
- assert_equal :original_return_value, instance.send(:my_instance_method)
43
+ assert_equal :original_return_value, instance.my_unprotected_instance_method
41
44
  end
42
45
 
43
46
  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 StubModuleMethodTest < Test::Unit::TestCase
@@ -32,12 +32,12 @@ class StubModuleMethodTest < Test::Unit::TestCase
32
32
  end
33
33
 
34
34
  def test_should_leave_stubbed_protected_method_unchanged_after_test
35
- mod = Module.new { class << self; def my_module_method; :original_return_value; end; protected :my_module_method; end }
35
+ mod = Module.new { class << self; def my_module_method; :original_return_value; end; protected :my_module_method; def my_unprotected_module_method; my_module_method; end; end }
36
36
  run_as_test do
37
37
  mod.stubs(:my_module_method).returns(:new_return_value)
38
38
  end
39
39
  assert mod.protected_methods(false).any? { |m| m.to_s == 'my_module_method' }
40
- assert_equal :original_return_value, mod.send(:my_module_method)
40
+ assert_equal :original_return_value, mod.my_unprotected_module_method
41
41
  end
42
42
 
43
43
  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 StubTest < Test::Unit::TestCase
@@ -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 Widget
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), "..", "test_helper")
1
+ require File.expand_path('../../test_helper', __FILE__)
2
2
  require 'deprecation_disabler'
3
3
 
4
4
  class StubbaTest < 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
  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 StubbingMethodUnnecessarilyTest < 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 StubbingNonExistentAnyInstanceMethodTest < Test::Unit::TestCase
@@ -19,7 +19,7 @@ class StubbingNonExistentAnyInstanceMethodTest < Test::Unit::TestCase
19
19
  test_result = run_as_test do
20
20
  klass.any_instance.stubs(:non_existent_method)
21
21
  end
22
- assert !@logger.warnings.include?("stubbing non-existent method: #{klass.any_instance}.non_existent_method")
22
+ assert !@logger.warnings.include?("stubbing non-existent method: #{klass.any_instance.mocha_inspect}.non_existent_method")
23
23
  assert_passed(test_result)
24
24
  end
25
25
 
@@ -30,7 +30,7 @@ class StubbingNonExistentAnyInstanceMethodTest < Test::Unit::TestCase
30
30
  klass.any_instance.stubs(:non_existent_method)
31
31
  end
32
32
  assert_passed(test_result)
33
- assert @logger.warnings.include?("stubbing non-existent method: #{klass.any_instance}.non_existent_method")
33
+ assert @logger.warnings.include?("stubbing non-existent method: #{klass.any_instance.mocha_inspect}.non_existent_method")
34
34
  end
35
35
 
36
36
  def test_should_prevent_stubbing_non_existent_any_instance_method
@@ -40,7 +40,7 @@ class StubbingNonExistentAnyInstanceMethodTest < Test::Unit::TestCase
40
40
  klass.any_instance.stubs(:non_existent_method)
41
41
  end
42
42
  assert_failed(test_result)
43
- assert test_result.error_messages.include?("Mocha::StubbingError: stubbing non-existent method: #{klass.any_instance}.non_existent_method")
43
+ assert test_result.error_messages.include?("Mocha::StubbingError: stubbing non-existent method: #{klass.any_instance.mocha_inspect}.non_existent_method")
44
44
  end
45
45
 
46
46
  def test_should_default_to_allow_stubbing_non_existent_any_instance_method
@@ -48,7 +48,7 @@ class StubbingNonExistentAnyInstanceMethodTest < Test::Unit::TestCase
48
48
  test_result = run_as_test do
49
49
  klass.any_instance.stubs(:non_existent_method)
50
50
  end
51
- assert !@logger.warnings.include?("stubbing non-existent method: #{klass.any_instance}.non_existent_method")
51
+ assert !@logger.warnings.include?("stubbing non-existent method: #{klass.any_instance.mocha_inspect}.non_existent_method")
52
52
  assert_passed(test_result)
53
53
  end
54
54
 
@@ -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 StubbingNonExistentClassMethodTest < Test::Unit::TestCase
@@ -19,7 +19,7 @@ class StubbingNonExistentClassMethodTest < Test::Unit::TestCase
19
19
  test_result = run_as_test do
20
20
  klass.stubs(:non_existent_method)
21
21
  end
22
- assert !@logger.warnings.include?("stubbing non-existent method: #{klass}.non_existent_method")
22
+ assert !@logger.warnings.include?("stubbing non-existent method: #{klass.mocha_inspect}.non_existent_method")
23
23
  assert_passed(test_result)
24
24
  end
25
25
 
@@ -30,7 +30,7 @@ class StubbingNonExistentClassMethodTest < Test::Unit::TestCase
30
30
  klass.stubs(:non_existent_method)
31
31
  end
32
32
  assert_passed(test_result)
33
- assert @logger.warnings.include?("stubbing non-existent method: #{klass}.non_existent_method")
33
+ assert @logger.warnings.include?("stubbing non-existent method: #{klass.mocha_inspect}.non_existent_method")
34
34
  end
35
35
 
36
36
  def test_should_prevent_stubbing_non_existent_class_method
@@ -40,7 +40,7 @@ class StubbingNonExistentClassMethodTest < Test::Unit::TestCase
40
40
  klass.stubs(:non_existent_method)
41
41
  end
42
42
  assert_failed(test_result)
43
- assert test_result.error_messages.include?("Mocha::StubbingError: stubbing non-existent method: #{klass}.non_existent_method")
43
+ assert test_result.error_messages.include?("Mocha::StubbingError: stubbing non-existent method: #{klass.mocha_inspect}.non_existent_method")
44
44
  end
45
45
 
46
46
  def test_should_default_to_allow_stubbing_non_existent_class_method
@@ -48,7 +48,7 @@ class StubbingNonExistentClassMethodTest < Test::Unit::TestCase
48
48
  test_result = run_as_test do
49
49
  klass.stubs(:non_existent_method)
50
50
  end
51
- assert !@logger.warnings.include?("stubbing non-existent method: #{klass}.non_existent_method")
51
+ assert !@logger.warnings.include?("stubbing non-existent method: #{klass.mocha_inspect}.non_existent_method")
52
52
  assert_passed(test_result)
53
53
  end
54
54
 
@@ -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 StubbingNonExistentInstanceMethodTest < Test::Unit::TestCase
@@ -19,7 +19,7 @@ class StubbingNonExistentInstanceMethodTest < Test::Unit::TestCase
19
19
  test_result = run_as_test do
20
20
  instance.stubs(:non_existent_method)
21
21
  end
22
- assert !@logger.warnings.include?("stubbing non-existent method: #{instance}.non_existent_method")
22
+ assert !@logger.warnings.include?("stubbing non-existent method: #{instance.mocha_inspect}.non_existent_method")
23
23
  assert_passed(test_result)
24
24
  end
25
25
 
@@ -30,7 +30,7 @@ class StubbingNonExistentInstanceMethodTest < Test::Unit::TestCase
30
30
  instance.stubs(:non_existent_method)
31
31
  end
32
32
  assert_passed(test_result)
33
- assert @logger.warnings.include?("stubbing non-existent method: #{instance}.non_existent_method")
33
+ assert @logger.warnings.include?("stubbing non-existent method: #{instance.mocha_inspect}.non_existent_method")
34
34
  end
35
35
 
36
36
  def test_should_prevent_stubbing_non_existent_instance_method
@@ -40,7 +40,7 @@ class StubbingNonExistentInstanceMethodTest < Test::Unit::TestCase
40
40
  instance.stubs(:non_existent_method)
41
41
  end
42
42
  assert_failed(test_result)
43
- assert test_result.error_messages.include?("Mocha::StubbingError: stubbing non-existent method: #{instance}.non_existent_method")
43
+ assert test_result.error_messages.include?("Mocha::StubbingError: stubbing non-existent method: #{instance.mocha_inspect}.non_existent_method")
44
44
  end
45
45
 
46
46
  def test_should_default_to_allow_stubbing_non_existent_instance_method
@@ -48,7 +48,7 @@ class StubbingNonExistentInstanceMethodTest < Test::Unit::TestCase
48
48
  test_result = run_as_test do
49
49
  instance.stubs(:non_existent_method)
50
50
  end
51
- assert !@logger.warnings.include?("stubbing non-existent method: #{instance}.non_existent_method")
51
+ assert !@logger.warnings.include?("stubbing non-existent method: #{instance.mocha_inspect}.non_existent_method")
52
52
  assert_passed(test_result)
53
53
  end
54
54
 
@@ -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 StubbingNonPublicAnyInstanceMethodTest < Test::Unit::TestCase
@@ -23,7 +23,7 @@ class StubbingNonPublicAnyInstanceMethodTest < Test::Unit::TestCase
23
23
  klass.any_instance.stubs(:private_method)
24
24
  end
25
25
  assert_passed(test_result)
26
- assert !@logger.warnings.include?("stubbing non-public method: #{klass.any_instance}.private_method")
26
+ assert !@logger.warnings.include?("stubbing non-public method: #{klass.any_instance.mocha_inspect}.private_method")
27
27
  end
28
28
 
29
29
  def test_should_allow_stubbing_protected_any_instance_method
@@ -36,7 +36,7 @@ class StubbingNonPublicAnyInstanceMethodTest < Test::Unit::TestCase
36
36
  klass.any_instance.stubs(:protected_method)
37
37
  end
38
38
  assert_passed(test_result)
39
- assert !@logger.warnings.include?("stubbing non-public method: #{klass.any_instance}.protected_method")
39
+ assert !@logger.warnings.include?("stubbing non-public method: #{klass.any_instance.mocha_inspect}.protected_method")
40
40
  end
41
41
 
42
42
  def test_should_warn_when_stubbing_private_any_instance_method
@@ -49,7 +49,7 @@ class StubbingNonPublicAnyInstanceMethodTest < Test::Unit::TestCase
49
49
  klass.any_instance.stubs(:private_method)
50
50
  end
51
51
  assert_passed(test_result)
52
- assert @logger.warnings.include?("stubbing non-public method: #{klass.any_instance}.private_method")
52
+ assert @logger.warnings.include?("stubbing non-public method: #{klass.any_instance.mocha_inspect}.private_method")
53
53
  end
54
54
 
55
55
  def test_should_warn_when_stubbing_protected_any_instance_method
@@ -62,7 +62,7 @@ class StubbingNonPublicAnyInstanceMethodTest < Test::Unit::TestCase
62
62
  klass.any_instance.stubs(:protected_method)
63
63
  end
64
64
  assert_passed(test_result)
65
- assert @logger.warnings.include?("stubbing non-public method: #{klass.any_instance}.protected_method")
65
+ assert @logger.warnings.include?("stubbing non-public method: #{klass.any_instance.mocha_inspect}.protected_method")
66
66
  end
67
67
 
68
68
  def test_should_prevent_stubbing_private_any_instance_method
@@ -75,7 +75,7 @@ class StubbingNonPublicAnyInstanceMethodTest < Test::Unit::TestCase
75
75
  klass.any_instance.stubs(:private_method)
76
76
  end
77
77
  assert_failed(test_result)
78
- assert test_result.error_messages.include?("Mocha::StubbingError: stubbing non-public method: #{klass.any_instance}.private_method")
78
+ assert test_result.error_messages.include?("Mocha::StubbingError: stubbing non-public method: #{klass.any_instance.mocha_inspect}.private_method")
79
79
  end
80
80
 
81
81
  def test_should_prevent_stubbing_protected_any_instance_method
@@ -88,7 +88,7 @@ class StubbingNonPublicAnyInstanceMethodTest < Test::Unit::TestCase
88
88
  klass.any_instance.stubs(:protected_method)
89
89
  end
90
90
  assert_failed(test_result)
91
- assert test_result.error_messages.include?("Mocha::StubbingError: stubbing non-public method: #{klass.any_instance}.protected_method")
91
+ assert test_result.error_messages.include?("Mocha::StubbingError: stubbing non-public method: #{klass.any_instance.mocha_inspect}.protected_method")
92
92
  end
93
93
 
94
94
  def test_should_default_to_allow_stubbing_private_any_instance_method
@@ -100,7 +100,7 @@ class StubbingNonPublicAnyInstanceMethodTest < Test::Unit::TestCase
100
100
  klass.any_instance.stubs(:private_method)
101
101
  end
102
102
  assert_passed(test_result)
103
- assert !@logger.warnings.include?("stubbing non-public method: #{klass.any_instance}.private_method")
103
+ assert !@logger.warnings.include?("stubbing non-public method: #{klass.any_instance.mocha_inspect}.private_method")
104
104
  end
105
105
 
106
106
  def test_should_default_to_allow_stubbing_protected_any_instance_method
@@ -112,7 +112,7 @@ class StubbingNonPublicAnyInstanceMethodTest < Test::Unit::TestCase
112
112
  klass.any_instance.stubs(:protected_method)
113
113
  end
114
114
  assert_passed(test_result)
115
- assert !@logger.warnings.include?("stubbing non-public method: #{klass.any_instance}.protected_method")
115
+ assert !@logger.warnings.include?("stubbing non-public method: #{klass.any_instance.mocha_inspect}.protected_method")
116
116
  end
117
117
 
118
118
  def test_should_allow_stubbing_public_any_instance_method