diff --git a/test/acceptance/stubbing_existing_method_is_allowed.rb b/test/acceptance/stubbing_existing_method_is_allowed.rb index 9eb9a086d..c1a6cb632 100644 --- a/test/acceptance/stubbing_existing_method_is_allowed.rb +++ b/test/acceptance/stubbing_existing_method_is_allowed.rb @@ -37,11 +37,15 @@ def assert_allows_stubbing_existing_method(visibility) end def assert_allows_stubbing_method(stubbed_method) - Mocha.configure { |c| c.stubbing_non_existent_method = :prevent } + Mocha.configure { |c| configure_violation(c, :prevent) } stub_owner_in_scope = stub_owner test_result = run_as_test do stub_owner_in_scope.stubs(stubbed_method) end assert_passed(test_result) end + + def configure_violation(config, treatment) + config.stubbing_non_existent_method = treatment + end end diff --git a/test/acceptance/stubbing_public_method_is_allowed.rb b/test/acceptance/stubbing_public_method_is_allowed.rb index 5bc41887a..d57374505 100644 --- a/test/acceptance/stubbing_public_method_is_allowed.rb +++ b/test/acceptance/stubbing_public_method_is_allowed.rb @@ -25,11 +25,15 @@ def test_should_allow_stubbing_method_responded_to end def assert_allows_stubbing_method(stubbed_method) - Mocha.configure { |c| c.stubbing_non_public_method = :prevent } + Mocha.configure { |c| configure_violation(c, :prevent) } stub_owner_in_scope = stub_owner test_result = run_as_test do stub_owner_in_scope.stubs(stubbed_method) end assert_passed(test_result) end + + def configure_violation(config, treatment) + config.stubbing_non_public_method = treatment + end end