Created
October 13, 2010 14:15
-
-
Save kv109/624105 to your computer and use it in GitHub Desktop.
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
#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