Skip to content

Instantly share code, notes, and snippets.

@rectalogic
Created July 6, 2012 17:55
Show Gist options
  • Save rectalogic/3061630 to your computer and use it in GitHub Desktop.
Save rectalogic/3061630 to your computer and use it in GitHub Desktop.
Extend rspec with a method similar to should_receive but that invokes the original method
module RSpec
module Mocks
module Methods
def should_receive_invoke(message, opts={}, &block)
original_method = self.method(message.to_sym)
should_receive(message, opts) do |*args|
original_method.call(*args)
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment