Skip to content

Instantly share code, notes, and snippets.

@cymen
Created April 27, 2012 01:32
Show Gist options
  • Save cymen/2504878 to your computer and use it in GitHub Desktop.
Save cymen/2504878 to your computer and use it in GitHub Desktop.
require './example'
describe Example do
it "can mock convert and return the 3rd argument" do
example = Example.new
example.stub(:convert)
example.should_receive(:convert).with(any_args()).and_return { |*args| args[2] }
result = example.convert('a', 'b', 'c')
result.should eq('c')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment