Skip to content

Instantly share code, notes, and snippets.

@kv109
Created October 13, 2010 14:15
Show Gist options
  • Save kv109/624105 to your computer and use it in GitHub Desktop.
Save kv109/624105 to your computer and use it in GitHub Desktop.
#example.rb
class Example
def initialize(method_name)
send method_name
end
end
#example_test.rb
require 'mocha'
must 'invoke method with given name' do
obj.expects(:some_method_name).once #once is optional, expecting only one invoke is a default behaviour for Mocha
obj = Example.new(:some_method_name)
end
#The only thing you want to know is that method named #some_method_name will be invoked on obj.
#You don't need define this method for this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment