Skip to content

Instantly share code, notes, and snippets.

@rafaelss
Created February 3, 2012 13:12
Show Gist options
  • Save rafaelss/1730125 to your computer and use it in GitHub Desktop.
Save rafaelss/1730125 to your computer and use it in GitHub Desktop.
should_receive/should_not_receive and respond_to?
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)
$ 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