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.
- data/COPYING.rdoc +3 -0
- data/{MIT-LICENSE → MIT-LICENSE.rdoc} +0 -0
- data/{README → README.rdoc} +7 -7
- data/{RELEASE → RELEASE.rdoc} +18 -0
- data/Rakefile +44 -28
- data/lib/mocha.rb +1 -0
- data/lib/mocha/class_method.rb +1 -3
- data/lib/mocha/expectation.rb +37 -34
- data/lib/mocha/integration/mini_test.rb +32 -4
- data/lib/mocha/integration/mini_test/exception_translation.rb +20 -0
- data/lib/mocha/integration/mini_test/{version_131_and_above.rb → version_13.rb} +7 -13
- data/lib/mocha/integration/mini_test/version_140.rb +52 -0
- data/lib/mocha/integration/mini_test/version_141.rb +56 -0
- data/lib/mocha/integration/mini_test/version_142_and_above.rb +47 -0
- data/lib/mocha/integration/test_unit.rb +23 -8
- data/lib/mocha/integration/test_unit/gem_version_200.rb +3 -0
- data/lib/mocha/integration/test_unit/{gem_version_201_and_above.rb → gem_version_201_to_202.rb} +4 -1
- data/lib/mocha/integration/test_unit/gem_version_203_to_209.rb +52 -0
- data/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb +3 -0
- data/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb +3 -0
- data/lib/mocha/mock.rb +33 -18
- data/lib/mocha/module_method.rb +1 -1
- data/lib/mocha/object.rb +144 -160
- data/lib/mocha/options.rb +1 -0
- data/lib/mocha/parameter_matchers/base.rb +50 -2
- data/test/acceptance/acceptance_test_helper.rb +1 -1
- data/test/acceptance/api_test.rb +1 -1
- data/test/acceptance/bug_18914_test.rb +1 -1
- data/test/acceptance/bug_21465_test.rb +1 -1
- data/test/acceptance/bug_21563_test.rb +1 -1
- data/test/acceptance/expected_invocation_count_test.rb +1 -1
- data/test/acceptance/failure_messages_test.rb +1 -1
- data/test/acceptance/minitest_test.rb +128 -124
- data/test/acceptance/mocha_example_test.rb +1 -1
- data/test/acceptance/mocha_test_result_test.rb +1 -1
- data/test/acceptance/mock_test.rb +1 -1
- data/test/acceptance/mock_with_initializer_block_test.rb +1 -1
- data/test/acceptance/mocked_methods_dispatch_test.rb +1 -1
- data/test/acceptance/optional_parameters_test.rb +1 -1
- data/test/acceptance/parameter_matcher_test.rb +38 -1
- data/test/acceptance/partial_mocks_test.rb +1 -1
- data/test/acceptance/return_value_test.rb +1 -1
- data/test/acceptance/sequence_test.rb +1 -1
- data/test/acceptance/states_test.rb +1 -1
- data/test/acceptance/stub_any_instance_method_test.rb +5 -2
- data/test/acceptance/stub_class_method_test.rb +5 -2
- data/test/acceptance/stub_everything_test.rb +1 -1
- data/test/acceptance/stub_instance_method_test.rb +5 -2
- data/test/acceptance/stub_module_method_test.rb +3 -3
- data/test/acceptance/stub_test.rb +1 -1
- data/test/acceptance/stubba_example_test.rb +1 -1
- data/test/acceptance/stubba_test.rb +1 -1
- data/test/acceptance/stubba_test_result_test.rb +1 -1
- data/test/acceptance/stubbing_error_backtrace_test.rb +1 -1
- data/test/acceptance/stubbing_method_unnecessarily_test.rb +1 -1
- data/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +5 -5
- data/test/acceptance/stubbing_non_existent_class_method_test.rb +5 -5
- data/test/acceptance/stubbing_non_existent_instance_method_test.rb +5 -5
- data/test/acceptance/stubbing_non_public_any_instance_method_test.rb +9 -9
- data/test/acceptance/stubbing_non_public_class_method_test.rb +9 -9
- data/test/acceptance/stubbing_non_public_instance_method_test.rb +9 -9
- data/test/acceptance/stubbing_on_non_mock_object_test.rb +5 -5
- data/test/mini_test_result.rb +74 -0
- data/test/test_helper.rb +3 -1
- data/test/test_runner.rb +25 -11
- data/test/unit/any_instance_method_test.rb +1 -1
- data/test/unit/array_inspect_test.rb +1 -1
- data/test/unit/backtrace_filter_test.rb +1 -1
- data/test/unit/cardinality_test.rb +1 -1
- data/test/unit/central_test.rb +1 -1
- data/test/unit/change_state_side_effect_test.rb +1 -1
- data/test/unit/class_method_test.rb +2 -2
- data/test/unit/configuration_test.rb +1 -1
- data/test/unit/date_time_inspect_test.rb +1 -1
- data/test/unit/exception_raiser_test.rb +1 -1
- data/test/unit/expectation_list_test.rb +1 -1
- data/test/unit/expectation_test.rb +1 -1
- data/test/unit/hash_inspect_test.rb +1 -1
- data/test/unit/in_state_ordering_constraint_test.rb +1 -1
- data/test/unit/metaclass_test.rb +1 -1
- data/test/unit/method_matcher_test.rb +1 -1
- data/test/unit/mock_test.rb +16 -14
- data/test/unit/mockery_test.rb +1 -1
- data/test/unit/multiple_yields_test.rb +1 -1
- data/test/unit/no_yields_test.rb +1 -1
- data/test/unit/object_inspect_test.rb +10 -9
- data/test/unit/object_test.rb +11 -10
- data/test/unit/parameter_matchers/all_of_test.rb +1 -1
- data/test/unit/parameter_matchers/any_of_test.rb +1 -1
- data/test/unit/parameter_matchers/anything_test.rb +1 -1
- data/test/unit/parameter_matchers/equals_test.rb +1 -1
- data/test/unit/parameter_matchers/has_entries_test.rb +1 -1
- data/test/unit/parameter_matchers/has_entry_test.rb +1 -1
- data/test/unit/parameter_matchers/has_key_test.rb +1 -1
- data/test/unit/parameter_matchers/has_value_test.rb +1 -1
- data/test/unit/parameter_matchers/includes_test.rb +5 -5
- data/test/unit/parameter_matchers/instance_of_test.rb +2 -2
- data/test/unit/parameter_matchers/is_a_test.rb +1 -1
- data/test/unit/parameter_matchers/kind_of_test.rb +1 -1
- data/test/unit/parameter_matchers/not_test.rb +1 -1
- data/test/unit/parameter_matchers/regexp_matches_test.rb +1 -1
- data/test/unit/parameter_matchers/responds_with_test.rb +1 -1
- data/test/unit/parameter_matchers/yaml_equivalent_test.rb +1 -1
- data/test/unit/parameters_matcher_test.rb +1 -1
- data/test/unit/return_values_test.rb +1 -1
- data/test/unit/sequence_test.rb +1 -1
- data/test/unit/single_return_value_test.rb +1 -1
- data/test/unit/single_yield_test.rb +1 -1
- data/test/unit/state_machine_test.rb +1 -1
- data/test/unit/string_inspect_test.rb +1 -1
- data/test/unit/yield_parameters_test.rb +1 -1
- metadata +43 -19
- data/COPYING +0 -3
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path('../acceptance_test_helper', __FILE__)
|
2
2
|
require 'mocha'
|
3
3
|
|
4
4
|
class StubbingNonPublicClassMethodTest < Test::Unit::TestCase
|
@@ -25,7 +25,7 @@ class StubbingNonPublicClassMethodTest < Test::Unit::TestCase
|
|
25
25
|
klass.stubs(:private_method)
|
26
26
|
end
|
27
27
|
assert_passed(test_result)
|
28
|
-
assert !@logger.warnings.include?("stubbing non-public method: #{klass}.private_method")
|
28
|
+
assert !@logger.warnings.include?("stubbing non-public method: #{klass.mocha_inspect}.private_method")
|
29
29
|
end
|
30
30
|
|
31
31
|
def test_should_allow_stubbing_protected_class_method
|
@@ -40,7 +40,7 @@ class StubbingNonPublicClassMethodTest < Test::Unit::TestCase
|
|
40
40
|
klass.stubs(:protected_method)
|
41
41
|
end
|
42
42
|
assert_passed(test_result)
|
43
|
-
assert !@logger.warnings.include?("stubbing non-public method: #{klass}.protected_method")
|
43
|
+
assert !@logger.warnings.include?("stubbing non-public method: #{klass.mocha_inspect}.protected_method")
|
44
44
|
end
|
45
45
|
|
46
46
|
def test_should_warn_when_stubbing_private_class_method
|
@@ -55,7 +55,7 @@ class StubbingNonPublicClassMethodTest < Test::Unit::TestCase
|
|
55
55
|
klass.stubs(:private_method)
|
56
56
|
end
|
57
57
|
assert_passed(test_result)
|
58
|
-
assert @logger.warnings.include?("stubbing non-public method: #{klass}.private_method")
|
58
|
+
assert @logger.warnings.include?("stubbing non-public method: #{klass.mocha_inspect}.private_method")
|
59
59
|
end
|
60
60
|
|
61
61
|
def test_should_warn_when_stubbing_protected_class_method
|
@@ -70,7 +70,7 @@ class StubbingNonPublicClassMethodTest < Test::Unit::TestCase
|
|
70
70
|
klass.stubs(:protected_method)
|
71
71
|
end
|
72
72
|
assert_passed(test_result)
|
73
|
-
assert @logger.warnings.include?("stubbing non-public method: #{klass}.protected_method")
|
73
|
+
assert @logger.warnings.include?("stubbing non-public method: #{klass.mocha_inspect}.protected_method")
|
74
74
|
end
|
75
75
|
|
76
76
|
def test_should_prevent_stubbing_private_class_method
|
@@ -85,7 +85,7 @@ class StubbingNonPublicClassMethodTest < Test::Unit::TestCase
|
|
85
85
|
klass.stubs(:private_method)
|
86
86
|
end
|
87
87
|
assert_failed(test_result)
|
88
|
-
assert test_result.error_messages.include?("Mocha::StubbingError: stubbing non-public method: #{klass}.private_method")
|
88
|
+
assert test_result.error_messages.include?("Mocha::StubbingError: stubbing non-public method: #{klass.mocha_inspect}.private_method")
|
89
89
|
end
|
90
90
|
|
91
91
|
def test_should_prevent_stubbing_protected_class_method
|
@@ -100,7 +100,7 @@ class StubbingNonPublicClassMethodTest < Test::Unit::TestCase
|
|
100
100
|
klass.stubs(:protected_method)
|
101
101
|
end
|
102
102
|
assert_failed(test_result)
|
103
|
-
assert test_result.error_messages.include?("Mocha::StubbingError: stubbing non-public method: #{klass}.protected_method")
|
103
|
+
assert test_result.error_messages.include?("Mocha::StubbingError: stubbing non-public method: #{klass.mocha_inspect}.protected_method")
|
104
104
|
end
|
105
105
|
|
106
106
|
def test_should_default_to_allow_stubbing_private_class_method
|
@@ -114,7 +114,7 @@ class StubbingNonPublicClassMethodTest < Test::Unit::TestCase
|
|
114
114
|
klass.stubs(:private_method)
|
115
115
|
end
|
116
116
|
assert_passed(test_result)
|
117
|
-
assert !@logger.warnings.include?("stubbing non-public method: #{klass}.private_method")
|
117
|
+
assert !@logger.warnings.include?("stubbing non-public method: #{klass.mocha_inspect}.private_method")
|
118
118
|
end
|
119
119
|
|
120
120
|
def test_should_default_to_allow_stubbing_protected_class_method
|
@@ -128,7 +128,7 @@ class StubbingNonPublicClassMethodTest < Test::Unit::TestCase
|
|
128
128
|
klass.stubs(:protected_method)
|
129
129
|
end
|
130
130
|
assert_passed(test_result)
|
131
|
-
assert !@logger.warnings.include?("stubbing non-public method: #{klass}.protected_method")
|
131
|
+
assert !@logger.warnings.include?("stubbing non-public method: #{klass.mocha_inspect}.protected_method")
|
132
132
|
end
|
133
133
|
|
134
134
|
def test_should_allow_stubbing_public_class_method
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path('../acceptance_test_helper', __FILE__)
|
2
2
|
require 'mocha'
|
3
3
|
|
4
4
|
class StubbingNonPublicInstanceMethodTest < Test::Unit::TestCase
|
@@ -23,7 +23,7 @@ class StubbingNonPublicInstanceMethodTest < Test::Unit::TestCase
|
|
23
23
|
instance.stubs(:private_method)
|
24
24
|
end
|
25
25
|
assert_passed(test_result)
|
26
|
-
assert !@logger.warnings.include?("stubbing non-public method: #{instance}.private_method")
|
26
|
+
assert !@logger.warnings.include?("stubbing non-public method: #{instance.mocha_inspect}.private_method")
|
27
27
|
end
|
28
28
|
|
29
29
|
def test_should_allow_stubbing_protected_instance_method
|
@@ -36,7 +36,7 @@ class StubbingNonPublicInstanceMethodTest < Test::Unit::TestCase
|
|
36
36
|
instance.stubs(:protected_method)
|
37
37
|
end
|
38
38
|
assert_passed(test_result)
|
39
|
-
assert !@logger.warnings.include?("stubbing non-public method: #{instance}.protected_method")
|
39
|
+
assert !@logger.warnings.include?("stubbing non-public method: #{instance.mocha_inspect}.protected_method")
|
40
40
|
end
|
41
41
|
|
42
42
|
def test_should_warn_when_stubbing_private_instance_method
|
@@ -49,7 +49,7 @@ class StubbingNonPublicInstanceMethodTest < Test::Unit::TestCase
|
|
49
49
|
instance.stubs(:private_method)
|
50
50
|
end
|
51
51
|
assert_passed(test_result)
|
52
|
-
assert @logger.warnings.include?("stubbing non-public method: #{instance}.private_method")
|
52
|
+
assert @logger.warnings.include?("stubbing non-public method: #{instance.mocha_inspect}.private_method")
|
53
53
|
end
|
54
54
|
|
55
55
|
def test_should_warn_when_stubbing_protected_instance_method
|
@@ -62,7 +62,7 @@ class StubbingNonPublicInstanceMethodTest < Test::Unit::TestCase
|
|
62
62
|
instance.stubs(:protected_method)
|
63
63
|
end
|
64
64
|
assert_passed(test_result)
|
65
|
-
assert @logger.warnings.include?("stubbing non-public method: #{instance}.protected_method")
|
65
|
+
assert @logger.warnings.include?("stubbing non-public method: #{instance.mocha_inspect}.protected_method")
|
66
66
|
end
|
67
67
|
|
68
68
|
def test_should_prevent_stubbing_private_instance_method
|
@@ -75,7 +75,7 @@ class StubbingNonPublicInstanceMethodTest < Test::Unit::TestCase
|
|
75
75
|
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: #{instance}.private_method")
|
78
|
+
assert test_result.error_messages.include?("Mocha::StubbingError: stubbing non-public method: #{instance.mocha_inspect}.private_method")
|
79
79
|
end
|
80
80
|
|
81
81
|
def test_should_prevent_stubbing_protected_instance_method
|
@@ -88,7 +88,7 @@ class StubbingNonPublicInstanceMethodTest < Test::Unit::TestCase
|
|
88
88
|
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: #{instance}.protected_method")
|
91
|
+
assert test_result.error_messages.include?("Mocha::StubbingError: stubbing non-public method: #{instance.mocha_inspect}.protected_method")
|
92
92
|
end
|
93
93
|
|
94
94
|
def test_should_default_to_allow_stubbing_private_instance_method
|
@@ -100,7 +100,7 @@ class StubbingNonPublicInstanceMethodTest < Test::Unit::TestCase
|
|
100
100
|
instance.stubs(:private_method)
|
101
101
|
end
|
102
102
|
assert_passed(test_result)
|
103
|
-
assert !@logger.warnings.include?("stubbing non-public method: #{instance}.private_method")
|
103
|
+
assert !@logger.warnings.include?("stubbing non-public method: #{instance.mocha_inspect}.private_method")
|
104
104
|
end
|
105
105
|
|
106
106
|
def test_should_default_to_allow_stubbing_protected_instance_method
|
@@ -112,7 +112,7 @@ class StubbingNonPublicInstanceMethodTest < Test::Unit::TestCase
|
|
112
112
|
instance.stubs(:protected_method)
|
113
113
|
end
|
114
114
|
assert_passed(test_result)
|
115
|
-
assert !@logger.warnings.include?("stubbing non-public method: #{instance}.protected_method")
|
115
|
+
assert !@logger.warnings.include?("stubbing non-public method: #{instance.mocha_inspect}.protected_method")
|
116
116
|
end
|
117
117
|
|
118
118
|
def test_should_allow_stubbing_public_instance_method
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path('../acceptance_test_helper', __FILE__)
|
2
2
|
require 'mocha'
|
3
3
|
|
4
4
|
class StubbingOnNonMockObjectTest < Test::Unit::TestCase
|
@@ -20,7 +20,7 @@ class StubbingOnNonMockObjectTest < Test::Unit::TestCase
|
|
20
20
|
non_mock_object.stubs(:existing_method)
|
21
21
|
end
|
22
22
|
assert_passed(test_result)
|
23
|
-
assert !@logger.warnings.include?("stubbing method on non-mock object: #{non_mock_object}.existing_method")
|
23
|
+
assert !@logger.warnings.include?("stubbing method on non-mock object: #{non_mock_object.mocha_inspect}.existing_method")
|
24
24
|
end
|
25
25
|
|
26
26
|
def test_should_warn_on_stubbing_method_on_non_mock_object
|
@@ -30,7 +30,7 @@ class StubbingOnNonMockObjectTest < Test::Unit::TestCase
|
|
30
30
|
non_mock_object.stubs(:existing_method)
|
31
31
|
end
|
32
32
|
assert_passed(test_result)
|
33
|
-
assert @logger.warnings.include?("stubbing method on non-mock object: #{non_mock_object}.existing_method")
|
33
|
+
assert @logger.warnings.include?("stubbing method on non-mock object: #{non_mock_object.mocha_inspect}.existing_method")
|
34
34
|
end
|
35
35
|
|
36
36
|
def test_should_prevent_stubbing_method_on_non_mock_object
|
@@ -40,7 +40,7 @@ class StubbingOnNonMockObjectTest < Test::Unit::TestCase
|
|
40
40
|
non_mock_object.stubs(:existing_method)
|
41
41
|
end
|
42
42
|
assert_failed(test_result)
|
43
|
-
assert test_result.error_messages.include?("Mocha::StubbingError: stubbing method on non-mock object: #{non_mock_object}.existing_method")
|
43
|
+
assert test_result.error_messages.include?("Mocha::StubbingError: stubbing method on non-mock object: #{non_mock_object.mocha_inspect}.existing_method")
|
44
44
|
end
|
45
45
|
|
46
46
|
def test_should_default_to_allow_stubbing_method_on_non_mock_object
|
@@ -49,7 +49,7 @@ class StubbingOnNonMockObjectTest < Test::Unit::TestCase
|
|
49
49
|
non_mock_object.stubs(:existing_method)
|
50
50
|
end
|
51
51
|
assert_passed(test_result)
|
52
|
-
assert !@logger.warnings.include?("stubbing method on non-mock object: #{non_mock_object}.existing_method")
|
52
|
+
assert !@logger.warnings.include?("stubbing method on non-mock object: #{non_mock_object.mocha_inspect}.existing_method")
|
53
53
|
end
|
54
54
|
|
55
55
|
def test_should_allow_stubbing_method_on_mock_object
|