Permalink
Browse files

Fixed Lighthouse bug #32 - stub_everything should mean mock responds …

…to anything.
  • Loading branch information...
1 parent 4922732 commit 5615d965463451cf75d6f05616a514f46798f2ff @floehopper floehopper committed Jan 29, 2009
Showing with 8 additions and 1 deletion.
  1. +1 −1 lib/mocha/mock.rb
  2. +7 −0 test/unit/mock_test.rb
View
@@ -173,7 +173,7 @@ def respond_to?(symbol, include_private = false)
@responder.respond_to?(symbol)
end
else
- @expectations.matches_method?(symbol)
+ @everything_stubbed || @expectations.matches_method?(symbol)
end
end
View
@@ -292,4 +292,11 @@ def test_should_handle_respond_to_with_private_methods_param_without_error
assert_nothing_raised{ mock.respond_to?(:object_id, false) }
end
+ def test_should_respond_to_any_method_if_stubbing_everything
+ mock = Mock.new
+ mock.stub_everything
+ assert mock.respond_to?(:abc)
+ assert mock.respond_to?(:xyz)
+ end
+
end

0 comments on commit 5615d96

Please sign in to comment.