Created
February 3, 2012 13:12
-
-
Save rafaelss/1730125 to your computer and use it in GitHub Desktop.
should_receive/should_not_receive and respond_to?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rspec/mocks" | |
include RSpec::Mocks::Methods | |
class MyClass; end | |
MyClass.should_receive(:my_method).never | |
puts MyClass.respond_to?(:my_method) | |
class MyOtherClass; end | |
MyOtherClass.should_not_receive(:my_method) | |
puts MyClass.respond_to?(:my_method) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ruby /tmp/test_mock.rb | |
true | |
true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment