mocha 0.9.5 → 0.9.6
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/RELEASE +17 -2
 - data/Rakefile +10 -7
 - data/examples/misc.rb +0 -1
 - data/examples/mocha.rb +0 -1
 - data/examples/stubba.rb +0 -1
 - data/lib/mocha.rb +1 -47
 - data/lib/mocha/any_instance_method.rb +5 -1
 - data/lib/mocha/{standalone.rb → api.rb} +8 -1
 - data/lib/mocha/class_method.rb +5 -1
 - data/lib/mocha/expectation.rb +3 -3
 - data/lib/mocha/integration.rb +38 -0
 - data/lib/mocha/integration/mini_test.rb +21 -0
 - data/lib/mocha/integration/mini_test/assertion_counter.rb +23 -0
 - data/lib/mocha/integration/mini_test/version_131_and_above.rb +50 -0
 - data/lib/mocha/integration/test_unit.rb +40 -0
 - data/lib/mocha/integration/test_unit/assertion_counter.rb +23 -0
 - data/lib/mocha/integration/test_unit/gem_version_200.rb +49 -0
 - data/lib/mocha/integration/test_unit/gem_version_201_and_above.rb +49 -0
 - data/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb +48 -0
 - data/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb +50 -0
 - data/lib/mocha/parameter_matchers/has_entry.rb +1 -0
 - data/lib/mocha_standalone.rb +2 -2
 - data/test/acceptance/{standalone_test.rb → api_test.rb} +2 -2
 - data/test/acceptance/bug_21465_test.rb +2 -2
 - data/test/acceptance/bug_21563_test.rb +1 -1
 - data/test/acceptance/expected_invocation_count_test.rb +19 -19
 - data/test/acceptance/failure_messages_test.rb +6 -6
 - data/test/acceptance/minitest_test.rb +32 -9
 - data/test/acceptance/mocha_test_result_test.rb +8 -8
 - data/test/acceptance/mock_test.rb +10 -10
 - data/test/acceptance/mock_with_initializer_block_test.rb +3 -3
 - data/test/acceptance/mocked_methods_dispatch_test.rb +5 -5
 - data/test/acceptance/optional_parameters_test.rb +6 -6
 - data/test/acceptance/parameter_matcher_test.rb +20 -20
 - data/test/acceptance/partial_mocks_test.rb +2 -2
 - data/test/acceptance/return_value_test.rb +4 -4
 - data/test/acceptance/sequence_test.rb +11 -11
 - data/test/acceptance/states_test.rb +4 -4
 - data/test/acceptance/stub_any_instance_method_test.rb +12 -12
 - data/test/acceptance/stub_class_method_test.rb +12 -12
 - data/test/acceptance/stub_everything_test.rb +4 -4
 - data/test/acceptance/stub_instance_method_test.rb +13 -13
 - data/test/acceptance/stub_module_method_test.rb +12 -12
 - data/test/acceptance/stub_test.rb +4 -4
 - data/test/acceptance/stubba_test.rb +1 -1
 - data/test/acceptance/stubba_test_result_test.rb +6 -6
 - data/test/acceptance/stubbing_error_backtrace_test.rb +4 -4
 - data/test/acceptance/stubbing_method_unnecessarily_test.rb +5 -5
 - data/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +10 -10
 - data/test/acceptance/stubbing_non_existent_class_method_test.rb +11 -11
 - data/test/acceptance/stubbing_non_existent_instance_method_test.rb +11 -11
 - data/test/acceptance/stubbing_non_public_any_instance_method_test.rb +9 -9
 - data/test/acceptance/stubbing_non_public_class_method_test.rb +10 -10
 - data/test/acceptance/stubbing_non_public_instance_method_test.rb +10 -10
 - data/test/acceptance/stubbing_on_non_mock_object_test.rb +5 -5
 - data/test/test_helper.rb +4 -0
 - data/test/test_runner.rb +1 -1
 - data/test/unit/parameter_matchers/has_entry_test.rb +20 -0
 - metadata +14 -6
 - data/lib/mocha/mini_test_adapter.rb +0 -50
 - data/lib/mocha/test_case_adapter.rb +0 -103
 
| 
         @@ -15,7 +15,7 @@ class StubModuleMethodTest < Test::Unit::TestCase 
     | 
|
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
              def test_should_stub_method_within_test
         
     | 
| 
       17 
17 
     | 
    
         
             
                mod = Module.new { def self.my_module_method; :original_return_value; end }
         
     | 
| 
       18 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 18 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       19 
19 
     | 
    
         
             
                  mod.stubs(:my_module_method).returns(:new_return_value)
         
     | 
| 
       20 
20 
     | 
    
         
             
                  assert_equal :new_return_value, mod.my_module_method
         
     | 
| 
       21 
21 
     | 
    
         
             
                end
         
     | 
| 
         @@ -24,7 +24,7 @@ class StubModuleMethodTest < Test::Unit::TestCase 
     | 
|
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
              def test_should_leave_stubbed_public_method_unchanged_after_test
         
     | 
| 
       26 
26 
     | 
    
         
             
                mod = Module.new { class << self; def my_module_method; :original_return_value; end; public :my_module_method; end }
         
     | 
| 
       27 
     | 
    
         
            -
                 
     | 
| 
      
 27 
     | 
    
         
            +
                run_as_test do
         
     | 
| 
       28 
28 
     | 
    
         
             
                  mod.stubs(:my_module_method).returns(:new_return_value)
         
     | 
| 
       29 
29 
     | 
    
         
             
                end
         
     | 
| 
       30 
30 
     | 
    
         
             
                assert mod.public_methods(false).any? { |m| m.to_s == 'my_module_method' }
         
     | 
| 
         @@ -33,7 +33,7 @@ class StubModuleMethodTest < Test::Unit::TestCase 
     | 
|
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
              def test_should_leave_stubbed_protected_method_unchanged_after_test
         
     | 
| 
       35 
35 
     | 
    
         
             
                mod = Module.new { class << self; def my_module_method; :original_return_value; end; protected :my_module_method; 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' }
         
     | 
| 
         @@ -42,7 +42,7 @@ class StubModuleMethodTest < Test::Unit::TestCase 
     | 
|
| 
       42 
42 
     | 
    
         | 
| 
       43 
43 
     | 
    
         
             
              def test_should_leave_stubbed_private_method_unchanged_after_test
         
     | 
| 
       44 
44 
     | 
    
         
             
                mod = Module.new { class << self; def my_module_method; :original_return_value; end; private :my_module_method; end }
         
     | 
| 
       45 
     | 
    
         
            -
                 
     | 
| 
      
 45 
     | 
    
         
            +
                run_as_test do
         
     | 
| 
       46 
46 
     | 
    
         
             
                  mod.stubs(:my_module_method).returns(:new_return_value)
         
     | 
| 
       47 
47 
     | 
    
         
             
                end
         
     | 
| 
       48 
48 
     | 
    
         
             
                assert mod.private_methods(false).any? { |m| m.to_s == 'my_module_method' }
         
     | 
| 
         @@ -51,7 +51,7 @@ class StubModuleMethodTest < Test::Unit::TestCase 
     | 
|
| 
       51 
51 
     | 
    
         | 
| 
       52 
52 
     | 
    
         
             
              def test_should_reset_expectations_after_test
         
     | 
| 
       53 
53 
     | 
    
         
             
                mod = Module.new { def self.my_module_method; :original_return_value; end }
         
     | 
| 
       54 
     | 
    
         
            -
                 
     | 
| 
      
 54 
     | 
    
         
            +
                run_as_test do
         
     | 
| 
       55 
55 
     | 
    
         
             
                  mod.stubs(:my_module_method)
         
     | 
| 
       56 
56 
     | 
    
         
             
                end
         
     | 
| 
       57 
57 
     | 
    
         
             
                assert_equal 0, mod.mocha.expectations.length
         
     | 
| 
         @@ -60,7 +60,7 @@ class StubModuleMethodTest < Test::Unit::TestCase 
     | 
|
| 
       60 
60 
     | 
    
         
             
              def test_should_be_able_to_stub_a_superclass_method
         
     | 
| 
       61 
61 
     | 
    
         
             
                supermod = Module.new { def self.my_superclass_method; :original_return_value; end }
         
     | 
| 
       62 
62 
     | 
    
         
             
                mod = Module.new { include supermod }
         
     | 
| 
       63 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 63 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       64 
64 
     | 
    
         
             
                  mod.stubs(:my_superclass_method).returns(:new_return_value)
         
     | 
| 
       65 
65 
     | 
    
         
             
                  assert_equal :new_return_value, mod.my_superclass_method
         
     | 
| 
       66 
66 
     | 
    
         
             
                end
         
     | 
| 
         @@ -78,7 +78,7 @@ class StubModuleMethodTest < Test::Unit::TestCase 
     | 
|
| 
       78 
78 
     | 
    
         
             
                    end
         
     | 
| 
       79 
79 
     | 
    
         
             
                  end
         
     | 
| 
       80 
80 
     | 
    
         
             
                end
         
     | 
| 
       81 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 81 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       82 
82 
     | 
    
         
             
                  ruby18_mod.stubs(:my_module_method).returns(:new_return_value)
         
     | 
| 
       83 
83 
     | 
    
         
             
                  assert_equal :new_return_value, ruby18_mod.my_module_method
         
     | 
| 
       84 
84 
     | 
    
         
             
                end
         
     | 
| 
         @@ -93,7 +93,7 @@ class StubModuleMethodTest < Test::Unit::TestCase 
     | 
|
| 
       93 
93 
     | 
    
         
             
                    end
         
     | 
| 
       94 
94 
     | 
    
         
             
                  end
         
     | 
| 
       95 
95 
     | 
    
         
             
                end
         
     | 
| 
       96 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 96 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       97 
97 
     | 
    
         
             
                  ruby19_mod.stubs(:my_module_method).returns(:new_return_value)
         
     | 
| 
       98 
98 
     | 
    
         
             
                  assert_equal :new_return_value, ruby19_mod.my_module_method
         
     | 
| 
       99 
99 
     | 
    
         
             
                end
         
     | 
| 
         @@ -108,7 +108,7 @@ class StubModuleMethodTest < Test::Unit::TestCase 
     | 
|
| 
       108 
108 
     | 
    
         
             
                    end
         
     | 
| 
       109 
109 
     | 
    
         
             
                  end
         
     | 
| 
       110 
110 
     | 
    
         
             
                end
         
     | 
| 
       111 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 111 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       112 
112 
     | 
    
         
             
                  ruby18_mod.stubs(:my_module_method).returns(:new_return_value)
         
     | 
| 
       113 
113 
     | 
    
         
             
                  assert_equal :new_return_value, ruby18_mod.my_module_method
         
     | 
| 
       114 
114 
     | 
    
         
             
                end
         
     | 
| 
         @@ -123,7 +123,7 @@ class StubModuleMethodTest < Test::Unit::TestCase 
     | 
|
| 
       123 
123 
     | 
    
         
             
                    end
         
     | 
| 
       124 
124 
     | 
    
         
             
                  end
         
     | 
| 
       125 
125 
     | 
    
         
             
                end
         
     | 
| 
       126 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 126 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       127 
127 
     | 
    
         
             
                  ruby19_mod.stubs(:my_module_method).returns(:new_return_value)
         
     | 
| 
       128 
128 
     | 
    
         
             
                  assert_equal :new_return_value, ruby19_mod.my_module_method
         
     | 
| 
       129 
129 
     | 
    
         
             
                end
         
     | 
| 
         @@ -138,7 +138,7 @@ class StubModuleMethodTest < Test::Unit::TestCase 
     | 
|
| 
       138 
138 
     | 
    
         
             
                    end
         
     | 
| 
       139 
139 
     | 
    
         
             
                  end
         
     | 
| 
       140 
140 
     | 
    
         
             
                end
         
     | 
| 
       141 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 141 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       142 
142 
     | 
    
         
             
                  ruby18_mod.stubs(:my_module_method).returns(:new_return_value)
         
     | 
| 
       143 
143 
     | 
    
         
             
                  assert_equal :new_return_value, ruby18_mod.my_module_method
         
     | 
| 
       144 
144 
     | 
    
         
             
                end
         
     | 
| 
         @@ -153,7 +153,7 @@ class StubModuleMethodTest < Test::Unit::TestCase 
     | 
|
| 
       153 
153 
     | 
    
         
             
                    end
         
     | 
| 
       154 
154 
     | 
    
         
             
                  end
         
     | 
| 
       155 
155 
     | 
    
         
             
                end
         
     | 
| 
       156 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 156 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       157 
157 
     | 
    
         
             
                  ruby19_mod.stubs(:my_module_method).returns(:new_return_value)
         
     | 
| 
       158 
158 
     | 
    
         
             
                  assert_equal :new_return_value, ruby19_mod.my_module_method
         
     | 
| 
       159 
159 
     | 
    
         
             
                end
         
     | 
| 
         @@ -14,7 +14,7 @@ class StubTest < Test::Unit::TestCase 
     | 
|
| 
       14 
14 
     | 
    
         
             
              end
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
              def test_should_build_stub_and_explicitly_add_an_expectation
         
     | 
| 
       17 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 17 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       18 
18 
     | 
    
         
             
                  foo = stub()
         
     | 
| 
       19 
19 
     | 
    
         
             
                  foo.stubs(:bar)
         
     | 
| 
       20 
20 
     | 
    
         
             
                  foo.bar
         
     | 
| 
         @@ -23,7 +23,7 @@ class StubTest < Test::Unit::TestCase 
     | 
|
| 
       23 
23 
     | 
    
         
             
              end
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
              def test_should_build_named_stub_and_explicitly_add_an_expectation
         
     | 
| 
       26 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 26 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       27 
27 
     | 
    
         
             
                  foo = stub('foo')
         
     | 
| 
       28 
28 
     | 
    
         
             
                  foo.stubs(:bar)
         
     | 
| 
       29 
29 
     | 
    
         
             
                  foo.bar
         
     | 
| 
         @@ -32,7 +32,7 @@ class StubTest < Test::Unit::TestCase 
     | 
|
| 
       32 
32 
     | 
    
         
             
              end
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
              def test_should_build_stub_incorporating_two_expectations
         
     | 
| 
       35 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 35 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       36 
36 
     | 
    
         
             
                  foo = stub(:bar => 'bar', :baz => 'baz')
         
     | 
| 
       37 
37 
     | 
    
         
             
                  foo.bar
         
     | 
| 
       38 
38 
     | 
    
         
             
                  foo.baz
         
     | 
| 
         @@ -41,7 +41,7 @@ class StubTest < Test::Unit::TestCase 
     | 
|
| 
       41 
41 
     | 
    
         
             
              end
         
     | 
| 
       42 
42 
     | 
    
         | 
| 
       43 
43 
     | 
    
         
             
              def test_should_build_named_stub_incorporating_two_expectations
         
     | 
| 
       44 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 44 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       45 
45 
     | 
    
         
             
                  foo = stub('foo', :bar => 'bar', :baz => 'baz')
         
     | 
| 
       46 
46 
     | 
    
         
             
                  foo.bar
         
     | 
| 
       47 
47 
     | 
    
         
             
                  foo.baz
         
     | 
| 
         @@ -9,7 +9,7 @@ class StubbaTest < Test::Unit::TestCase 
     | 
|
| 
       9 
9 
     | 
    
         
             
                disable_deprecations do
         
     | 
| 
       10 
10 
     | 
    
         
             
                  load 'stubba.rb'
         
     | 
| 
       11 
11 
     | 
    
         
             
                end
         
     | 
| 
       12 
     | 
    
         
            -
                 
     | 
| 
      
 12 
     | 
    
         
            +
                assert Mocha::Deprecation.messages.include?("require 'stubba' is no longer needed and stubba.rb will soon be removed")
         
     | 
| 
       13 
13 
     | 
    
         
             
              end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
            end
         
     | 
| 
         @@ -15,7 +15,7 @@ class StubbaTestResultTest < Test::Unit::TestCase 
     | 
|
| 
       15 
15 
     | 
    
         
             
              end
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
              def test_should_include_expectation_verification_in_assertion_count
         
     | 
| 
       18 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 18 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       19 
19 
     | 
    
         
             
                  object = Class.new { def message; end }.new
         
     | 
| 
       20 
20 
     | 
    
         
             
                  object.expects(:message)
         
     | 
| 
       21 
21 
     | 
    
         
             
                  object.message
         
     | 
| 
         @@ -24,14 +24,14 @@ class StubbaTestResultTest < Test::Unit::TestCase 
     | 
|
| 
       24 
24 
     | 
    
         
             
              end
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
              def test_should_include_assertions_in_assertion_count
         
     | 
| 
       27 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 27 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       28 
28 
     | 
    
         
             
                  assert true
         
     | 
| 
       29 
29 
     | 
    
         
             
                end
         
     | 
| 
       30 
30 
     | 
    
         
             
                assert_equal 1, test_result.assertion_count
         
     | 
| 
       31 
31 
     | 
    
         
             
              end
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
              def test_should_not_include_stubbing_expectation_verification_in_assertion_count
         
     | 
| 
       34 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 34 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       35 
35 
     | 
    
         
             
                  object = Class.new { def message; end }.new
         
     | 
| 
       36 
36 
     | 
    
         
             
                  object.stubs(:message)
         
     | 
| 
       37 
37 
     | 
    
         
             
                  object.message
         
     | 
| 
         @@ -40,7 +40,7 @@ class StubbaTestResultTest < Test::Unit::TestCase 
     | 
|
| 
       40 
40 
     | 
    
         
             
              end
         
     | 
| 
       41 
41 
     | 
    
         | 
| 
       42 
42 
     | 
    
         
             
              def test_should_include_expectation_verification_failure_in_failure_count
         
     | 
| 
       43 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 43 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       44 
44 
     | 
    
         
             
                  object = Class.new { def message; end }.new
         
     | 
| 
       45 
45 
     | 
    
         
             
                  object.expects(:message)
         
     | 
| 
       46 
46 
     | 
    
         
             
                end
         
     | 
| 
         @@ -48,7 +48,7 @@ class StubbaTestResultTest < Test::Unit::TestCase 
     | 
|
| 
       48 
48 
     | 
    
         
             
              end
         
     | 
| 
       49 
49 
     | 
    
         | 
| 
       50 
50 
     | 
    
         
             
              def test_should_include_assertion_failure_in_failure_count
         
     | 
| 
       51 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 51 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       52 
52 
     | 
    
         
             
                  flunk
         
     | 
| 
       53 
53 
     | 
    
         
             
                end
         
     | 
| 
       54 
54 
     | 
    
         
             
                assert_equal 1, test_result.failure_count
         
     | 
| 
         @@ -56,7 +56,7 @@ class StubbaTestResultTest < Test::Unit::TestCase 
     | 
|
| 
       56 
56 
     | 
    
         | 
| 
       57 
57 
     | 
    
         
             
              def test_should_display_backtrace_indicating_line_number_where_failing_assertion_was_called
         
     | 
| 
       58 
58 
     | 
    
         
             
                execution_point = nil
         
     | 
| 
       59 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 59 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       60 
60 
     | 
    
         
             
                  execution_point = ExecutionPoint.current; flunk
         
     | 
| 
       61 
61 
     | 
    
         
             
                end
         
     | 
| 
       62 
62 
     | 
    
         
             
                assert_equal 1, test_result.failure_count
         
     | 
| 
         @@ -18,7 +18,7 @@ class StubbingErrorBacktraceTest < Test::Unit::TestCase 
     | 
|
| 
       18 
18 
     | 
    
         
             
                execution_point = nil
         
     | 
| 
       19 
19 
     | 
    
         
             
                object = Object.new
         
     | 
| 
       20 
20 
     | 
    
         
             
                Mocha::Configuration.prevent(:stubbing_non_existent_method)
         
     | 
| 
       21 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 21 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       22 
22 
     | 
    
         
             
                  execution_point = ExecutionPoint.current; object.stubs(:non_existent_method)
         
     | 
| 
       23 
23 
     | 
    
         
             
                end
         
     | 
| 
       24 
24 
     | 
    
         
             
                assert_equal 1, test_result.error_count
         
     | 
| 
         @@ -32,7 +32,7 @@ class StubbingErrorBacktraceTest < Test::Unit::TestCase 
     | 
|
| 
       32 
32 
     | 
    
         
             
                  private :non_public_method
         
     | 
| 
       33 
33 
     | 
    
         
             
                end.new
         
     | 
| 
       34 
34 
     | 
    
         
             
                Mocha::Configuration.prevent(:stubbing_non_public_method)
         
     | 
| 
       35 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 35 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       36 
36 
     | 
    
         
             
                  execution_point = ExecutionPoint.current; object.stubs(:non_public_method)
         
     | 
| 
       37 
37 
     | 
    
         
             
                end
         
     | 
| 
       38 
38 
     | 
    
         
             
                assert_equal 1, test_result.error_count
         
     | 
| 
         @@ -43,7 +43,7 @@ class StubbingErrorBacktraceTest < Test::Unit::TestCase 
     | 
|
| 
       43 
43 
     | 
    
         
             
                execution_point = nil
         
     | 
| 
       44 
44 
     | 
    
         
             
                object = Object.new
         
     | 
| 
       45 
45 
     | 
    
         
             
                Mocha::Configuration.prevent(:stubbing_method_on_non_mock_object)
         
     | 
| 
       46 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 46 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       47 
47 
     | 
    
         
             
                  execution_point = ExecutionPoint.current; object.stubs(:any_method)
         
     | 
| 
       48 
48 
     | 
    
         
             
                end
         
     | 
| 
       49 
49 
     | 
    
         
             
                assert_equal 1, test_result.error_count
         
     | 
| 
         @@ -54,7 +54,7 @@ class StubbingErrorBacktraceTest < Test::Unit::TestCase 
     | 
|
| 
       54 
54 
     | 
    
         
             
                execution_point = nil
         
     | 
| 
       55 
55 
     | 
    
         
             
                object = Object.new
         
     | 
| 
       56 
56 
     | 
    
         
             
                Mocha::Configuration.prevent(:stubbing_method_unnecessarily)
         
     | 
| 
       57 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 57 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       58 
58 
     | 
    
         
             
                  execution_point = ExecutionPoint.current; object.stubs(:unused_method)
         
     | 
| 
       59 
59 
     | 
    
         
             
                end
         
     | 
| 
       60 
60 
     | 
    
         
             
                assert_equal 1, test_result.error_count
         
     | 
| 
         @@ -15,7 +15,7 @@ class StubbingMethodUnnecessarilyTest < Test::Unit::TestCase 
     | 
|
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
              def test_should_allow_stubbing_method_unnecessarily
         
     | 
| 
       17 
17 
     | 
    
         
             
                Mocha::Configuration.allow(:stubbing_method_unnecessarily)
         
     | 
| 
       18 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 18 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       19 
19 
     | 
    
         
             
                  mock = mock('mock')
         
     | 
| 
       20 
20 
     | 
    
         
             
                  mock.stubs(:public_method)
         
     | 
| 
       21 
21 
     | 
    
         
             
                end
         
     | 
| 
         @@ -25,7 +25,7 @@ class StubbingMethodUnnecessarilyTest < Test::Unit::TestCase 
     | 
|
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
              def test_should_warn_when_stubbing_method_unnecessarily
         
     | 
| 
       27 
27 
     | 
    
         
             
                Mocha::Configuration.warn_when(:stubbing_method_unnecessarily)
         
     | 
| 
       28 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 28 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       29 
29 
     | 
    
         
             
                  mock = mock('mock')
         
     | 
| 
       30 
30 
     | 
    
         
             
                  mock.stubs(:public_method)
         
     | 
| 
       31 
31 
     | 
    
         
             
                end
         
     | 
| 
         @@ -35,7 +35,7 @@ class StubbingMethodUnnecessarilyTest < Test::Unit::TestCase 
     | 
|
| 
       35 
35 
     | 
    
         | 
| 
       36 
36 
     | 
    
         
             
              def test_should_prevent_stubbing_method_unnecessarily
         
     | 
| 
       37 
37 
     | 
    
         
             
                Mocha::Configuration.prevent(:stubbing_method_unnecessarily)
         
     | 
| 
       38 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 38 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       39 
39 
     | 
    
         
             
                  mock = mock('mock')
         
     | 
| 
       40 
40 
     | 
    
         
             
                  mock.stubs(:public_method)
         
     | 
| 
       41 
41 
     | 
    
         
             
                end
         
     | 
| 
         @@ -44,7 +44,7 @@ class StubbingMethodUnnecessarilyTest < Test::Unit::TestCase 
     | 
|
| 
       44 
44 
     | 
    
         
             
              end
         
     | 
| 
       45 
45 
     | 
    
         | 
| 
       46 
46 
     | 
    
         
             
              def test_should_default_to_allow_stubbing_method_unnecessarily
         
     | 
| 
       47 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 47 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       48 
48 
     | 
    
         
             
                  mock = mock('mock')
         
     | 
| 
       49 
49 
     | 
    
         
             
                  mock.stubs(:public_method)
         
     | 
| 
       50 
50 
     | 
    
         
             
                end
         
     | 
| 
         @@ -54,7 +54,7 @@ class StubbingMethodUnnecessarilyTest < Test::Unit::TestCase 
     | 
|
| 
       54 
54 
     | 
    
         | 
| 
       55 
55 
     | 
    
         
             
              def test_should_allow_stubbing_method_when_stubbed_method_is_invoked
         
     | 
| 
       56 
56 
     | 
    
         
             
                Mocha::Configuration.prevent(:stubbing_method_unnecessarily)
         
     | 
| 
       57 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 57 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       58 
58 
     | 
    
         
             
                  mock = mock('mock')
         
     | 
| 
       59 
59 
     | 
    
         
             
                  mock.stubs(:public_method)
         
     | 
| 
       60 
60 
     | 
    
         
             
                  mock.public_method
         
     | 
| 
         @@ -16,7 +16,7 @@ class StubbingNonExistentAnyInstanceMethodTest < Test::Unit::TestCase 
     | 
|
| 
       16 
16 
     | 
    
         
             
              def test_should_allow_stubbing_non_existent_any_instance_method
         
     | 
| 
       17 
17 
     | 
    
         
             
                Mocha::Configuration.allow(:stubbing_non_existent_method)
         
     | 
| 
       18 
18 
     | 
    
         
             
                klass = Class.new
         
     | 
| 
       19 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 19 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       20 
20 
     | 
    
         
             
                  klass.any_instance.stubs(:non_existent_method)
         
     | 
| 
       21 
21 
     | 
    
         
             
                end
         
     | 
| 
       22 
22 
     | 
    
         
             
                assert !@logger.warnings.include?("stubbing non-existent method: #{klass.any_instance}.non_existent_method")
         
     | 
| 
         @@ -26,7 +26,7 @@ class StubbingNonExistentAnyInstanceMethodTest < Test::Unit::TestCase 
     | 
|
| 
       26 
26 
     | 
    
         
             
              def test_should_warn_when_stubbing_non_existent_any_instance_method
         
     | 
| 
       27 
27 
     | 
    
         
             
                Mocha::Configuration.warn_when(:stubbing_non_existent_method)
         
     | 
| 
       28 
28 
     | 
    
         
             
                klass = Class.new
         
     | 
| 
       29 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 29 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       30 
30 
     | 
    
         
             
                  klass.any_instance.stubs(:non_existent_method)
         
     | 
| 
       31 
31 
     | 
    
         
             
                end
         
     | 
| 
       32 
32 
     | 
    
         
             
                assert_passed(test_result)
         
     | 
| 
         @@ -36,7 +36,7 @@ class StubbingNonExistentAnyInstanceMethodTest < Test::Unit::TestCase 
     | 
|
| 
       36 
36 
     | 
    
         
             
              def test_should_prevent_stubbing_non_existent_any_instance_method
         
     | 
| 
       37 
37 
     | 
    
         
             
                Mocha::Configuration.prevent(:stubbing_non_existent_method)
         
     | 
| 
       38 
38 
     | 
    
         
             
                klass = Class.new
         
     | 
| 
       39 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 39 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       40 
40 
     | 
    
         
             
                  klass.any_instance.stubs(:non_existent_method)
         
     | 
| 
       41 
41 
     | 
    
         
             
                end
         
     | 
| 
       42 
42 
     | 
    
         
             
                assert_failed(test_result)
         
     | 
| 
         @@ -45,7 +45,7 @@ class StubbingNonExistentAnyInstanceMethodTest < Test::Unit::TestCase 
     | 
|
| 
       45 
45 
     | 
    
         | 
| 
       46 
46 
     | 
    
         
             
              def test_should_default_to_allow_stubbing_non_existent_any_instance_method
         
     | 
| 
       47 
47 
     | 
    
         
             
                klass = Class.new
         
     | 
| 
       48 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 48 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       49 
49 
     | 
    
         
             
                  klass.any_instance.stubs(:non_existent_method)
         
     | 
| 
       50 
50 
     | 
    
         
             
                end
         
     | 
| 
       51 
51 
     | 
    
         
             
                assert !@logger.warnings.include?("stubbing non-existent method: #{klass.any_instance}.non_existent_method")
         
     | 
| 
         @@ -58,7 +58,7 @@ class StubbingNonExistentAnyInstanceMethodTest < Test::Unit::TestCase 
     | 
|
| 
       58 
58 
     | 
    
         
             
                  def existing_public_method; end
         
     | 
| 
       59 
59 
     | 
    
         
             
                  public :existing_public_method
         
     | 
| 
       60 
60 
     | 
    
         
             
                end
         
     | 
| 
       61 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 61 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       62 
62 
     | 
    
         
             
                  klass.any_instance.stubs(:existing_public_method)
         
     | 
| 
       63 
63 
     | 
    
         
             
                end
         
     | 
| 
       64 
64 
     | 
    
         
             
                assert_passed(test_result)
         
     | 
| 
         @@ -70,7 +70,7 @@ class StubbingNonExistentAnyInstanceMethodTest < Test::Unit::TestCase 
     | 
|
| 
       70 
70 
     | 
    
         
             
                  def existing_protected_method; end
         
     | 
| 
       71 
71 
     | 
    
         
             
                  protected :existing_protected_method
         
     | 
| 
       72 
72 
     | 
    
         
             
                end
         
     | 
| 
       73 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 73 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       74 
74 
     | 
    
         
             
                  klass.any_instance.stubs(:existing_protected_method)
         
     | 
| 
       75 
75 
     | 
    
         
             
                end
         
     | 
| 
       76 
76 
     | 
    
         
             
                assert_passed(test_result)
         
     | 
| 
         @@ -82,7 +82,7 @@ class StubbingNonExistentAnyInstanceMethodTest < Test::Unit::TestCase 
     | 
|
| 
       82 
82 
     | 
    
         
             
                  def existing_private_method; end
         
     | 
| 
       83 
83 
     | 
    
         
             
                  private :existing_private_method
         
     | 
| 
       84 
84 
     | 
    
         
             
                end
         
     | 
| 
       85 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 85 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       86 
86 
     | 
    
         
             
                  klass.any_instance.stubs(:existing_private_method)
         
     | 
| 
       87 
87 
     | 
    
         
             
                end
         
     | 
| 
       88 
88 
     | 
    
         
             
                assert_passed(test_result)
         
     | 
| 
         @@ -95,7 +95,7 @@ class StubbingNonExistentAnyInstanceMethodTest < Test::Unit::TestCase 
     | 
|
| 
       95 
95 
     | 
    
         
             
                  public :existing_public_method
         
     | 
| 
       96 
96 
     | 
    
         
             
                end
         
     | 
| 
       97 
97 
     | 
    
         
             
                klass = Class.new(superklass)
         
     | 
| 
       98 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 98 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       99 
99 
     | 
    
         
             
                  klass.any_instance.stubs(:existing_public_method)
         
     | 
| 
       100 
100 
     | 
    
         
             
                end
         
     | 
| 
       101 
101 
     | 
    
         
             
                assert_passed(test_result)
         
     | 
| 
         @@ -108,7 +108,7 @@ class StubbingNonExistentAnyInstanceMethodTest < Test::Unit::TestCase 
     | 
|
| 
       108 
108 
     | 
    
         
             
                  protected :existing_protected_method
         
     | 
| 
       109 
109 
     | 
    
         
             
                end
         
     | 
| 
       110 
110 
     | 
    
         
             
                klass = Class.new(superklass)
         
     | 
| 
       111 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 111 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       112 
112 
     | 
    
         
             
                  klass.any_instance.stubs(:existing_protected_method)
         
     | 
| 
       113 
113 
     | 
    
         
             
                end
         
     | 
| 
       114 
114 
     | 
    
         
             
                assert_passed(test_result)
         
     | 
| 
         @@ -121,7 +121,7 @@ class StubbingNonExistentAnyInstanceMethodTest < Test::Unit::TestCase 
     | 
|
| 
       121 
121 
     | 
    
         
             
                  private :existing_private_method
         
     | 
| 
       122 
122 
     | 
    
         
             
                end
         
     | 
| 
       123 
123 
     | 
    
         
             
                klass = Class.new(superklass)
         
     | 
| 
       124 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 124 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       125 
125 
     | 
    
         
             
                  klass.any_instance.stubs(:existing_private_method)
         
     | 
| 
       126 
126 
     | 
    
         
             
                end
         
     | 
| 
       127 
127 
     | 
    
         
             
                assert_passed(test_result)
         
     | 
| 
         @@ -16,7 +16,7 @@ class StubbingNonExistentClassMethodTest < Test::Unit::TestCase 
     | 
|
| 
       16 
16 
     | 
    
         
             
              def test_should_allow_stubbing_non_existent_class_method
         
     | 
| 
       17 
17 
     | 
    
         
             
                Mocha::Configuration.allow(:stubbing_non_existent_method)
         
     | 
| 
       18 
18 
     | 
    
         
             
                klass = Class.new
         
     | 
| 
       19 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 19 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       20 
20 
     | 
    
         
             
                  klass.stubs(:non_existent_method)
         
     | 
| 
       21 
21 
     | 
    
         
             
                end
         
     | 
| 
       22 
22 
     | 
    
         
             
                assert !@logger.warnings.include?("stubbing non-existent method: #{klass}.non_existent_method")
         
     | 
| 
         @@ -26,7 +26,7 @@ class StubbingNonExistentClassMethodTest < Test::Unit::TestCase 
     | 
|
| 
       26 
26 
     | 
    
         
             
              def test_should_warn_when_stubbing_non_existent_class_method
         
     | 
| 
       27 
27 
     | 
    
         
             
                Mocha::Configuration.warn_when(:stubbing_non_existent_method)
         
     | 
| 
       28 
28 
     | 
    
         
             
                klass = Class.new
         
     | 
| 
       29 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 29 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       30 
30 
     | 
    
         
             
                  klass.stubs(:non_existent_method)
         
     | 
| 
       31 
31 
     | 
    
         
             
                end
         
     | 
| 
       32 
32 
     | 
    
         
             
                assert_passed(test_result)
         
     | 
| 
         @@ -36,7 +36,7 @@ class StubbingNonExistentClassMethodTest < Test::Unit::TestCase 
     | 
|
| 
       36 
36 
     | 
    
         
             
              def test_should_prevent_stubbing_non_existent_class_method
         
     | 
| 
       37 
37 
     | 
    
         
             
                Mocha::Configuration.prevent(:stubbing_non_existent_method)
         
     | 
| 
       38 
38 
     | 
    
         
             
                klass = Class.new
         
     | 
| 
       39 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 39 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       40 
40 
     | 
    
         
             
                  klass.stubs(:non_existent_method)
         
     | 
| 
       41 
41 
     | 
    
         
             
                end
         
     | 
| 
       42 
42 
     | 
    
         
             
                assert_failed(test_result)
         
     | 
| 
         @@ -45,7 +45,7 @@ class StubbingNonExistentClassMethodTest < Test::Unit::TestCase 
     | 
|
| 
       45 
45 
     | 
    
         | 
| 
       46 
46 
     | 
    
         
             
              def test_should_default_to_allow_stubbing_non_existent_class_method
         
     | 
| 
       47 
47 
     | 
    
         
             
                klass = Class.new
         
     | 
| 
       48 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 48 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       49 
49 
     | 
    
         
             
                  klass.stubs(:non_existent_method)
         
     | 
| 
       50 
50 
     | 
    
         
             
                end
         
     | 
| 
       51 
51 
     | 
    
         
             
                assert !@logger.warnings.include?("stubbing non-existent method: #{klass}.non_existent_method")
         
     | 
| 
         @@ -60,7 +60,7 @@ class StubbingNonExistentClassMethodTest < Test::Unit::TestCase 
     | 
|
| 
       60 
60 
     | 
    
         
             
                    public :existing_public_method
         
     | 
| 
       61 
61 
     | 
    
         
             
                  end
         
     | 
| 
       62 
62 
     | 
    
         
             
                end
         
     | 
| 
       63 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 63 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       64 
64 
     | 
    
         
             
                  klass.stubs(:existing_public_method)
         
     | 
| 
       65 
65 
     | 
    
         
             
                end
         
     | 
| 
       66 
66 
     | 
    
         
             
                assert_passed(test_result)
         
     | 
| 
         @@ -75,7 +75,7 @@ class StubbingNonExistentClassMethodTest < Test::Unit::TestCase 
     | 
|
| 
       75 
75 
     | 
    
         
             
                    end
         
     | 
| 
       76 
76 
     | 
    
         
             
                  end
         
     | 
| 
       77 
77 
     | 
    
         
             
                end
         
     | 
| 
       78 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 78 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       79 
79 
     | 
    
         
             
                  klass.stubs(:method_to_which_class_responds)
         
     | 
| 
       80 
80 
     | 
    
         
             
                end
         
     | 
| 
       81 
81 
     | 
    
         
             
                assert_passed(test_result)
         
     | 
| 
         @@ -89,7 +89,7 @@ class StubbingNonExistentClassMethodTest < Test::Unit::TestCase 
     | 
|
| 
       89 
89 
     | 
    
         
             
                    protected :existing_protected_method
         
     | 
| 
       90 
90 
     | 
    
         
             
                  end
         
     | 
| 
       91 
91 
     | 
    
         
             
                end
         
     | 
| 
       92 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 92 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       93 
93 
     | 
    
         
             
                  klass.stubs(:existing_protected_method)
         
     | 
| 
       94 
94 
     | 
    
         
             
                end
         
     | 
| 
       95 
95 
     | 
    
         
             
                assert_passed(test_result)
         
     | 
| 
         @@ -103,7 +103,7 @@ class StubbingNonExistentClassMethodTest < Test::Unit::TestCase 
     | 
|
| 
       103 
103 
     | 
    
         
             
                    private :existing_private_method
         
     | 
| 
       104 
104 
     | 
    
         
             
                  end
         
     | 
| 
       105 
105 
     | 
    
         
             
                end
         
     | 
| 
       106 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 106 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       107 
107 
     | 
    
         
             
                  klass.stubs(:existing_private_method)
         
     | 
| 
       108 
108 
     | 
    
         
             
                end
         
     | 
| 
       109 
109 
     | 
    
         
             
                assert_passed(test_result)
         
     | 
| 
         @@ -118,7 +118,7 @@ class StubbingNonExistentClassMethodTest < Test::Unit::TestCase 
     | 
|
| 
       118 
118 
     | 
    
         
             
                  end
         
     | 
| 
       119 
119 
     | 
    
         
             
                end
         
     | 
| 
       120 
120 
     | 
    
         
             
                klass = Class.new(superklass)
         
     | 
| 
       121 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 121 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       122 
122 
     | 
    
         
             
                  klass.stubs(:existing_public_method)
         
     | 
| 
       123 
123 
     | 
    
         
             
                end
         
     | 
| 
       124 
124 
     | 
    
         
             
                assert_passed(test_result)
         
     | 
| 
         @@ -133,7 +133,7 @@ class StubbingNonExistentClassMethodTest < Test::Unit::TestCase 
     | 
|
| 
       133 
133 
     | 
    
         
             
                  end
         
     | 
| 
       134 
134 
     | 
    
         
             
                end
         
     | 
| 
       135 
135 
     | 
    
         
             
                klass = Class.new(superklass)
         
     | 
| 
       136 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 136 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       137 
137 
     | 
    
         
             
                  klass.stubs(:existing_protected_method)
         
     | 
| 
       138 
138 
     | 
    
         
             
                end
         
     | 
| 
       139 
139 
     | 
    
         
             
                assert_passed(test_result)
         
     | 
| 
         @@ -148,7 +148,7 @@ class StubbingNonExistentClassMethodTest < Test::Unit::TestCase 
     | 
|
| 
       148 
148 
     | 
    
         
             
                  end
         
     | 
| 
       149 
149 
     | 
    
         
             
                end
         
     | 
| 
       150 
150 
     | 
    
         
             
                klass = Class.new(superklass)
         
     | 
| 
       151 
     | 
    
         
            -
                test_result =  
     | 
| 
      
 151 
     | 
    
         
            +
                test_result = run_as_test do
         
     | 
| 
       152 
152 
     | 
    
         
             
                  klass.stubs(:existing_private_method)
         
     | 
| 
       153 
153 
     | 
    
         
             
                end
         
     | 
| 
       154 
154 
     | 
    
         
             
                assert_passed(test_result)
         
     |