Created
April 17, 2012 17:33
-
-
Save cfcosta/2407670 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
>> require "minitest/mock" | |
=> true | |
>> mock = MiniTest::Mock.new | |
=> #<MiniTest::Mock:0x007fc48ca57d70 @expected_calls={}, @actual_calls={}> | |
>> mock.respond_to? :abc | |
=> false | |
>> mock.expect(:abc, "123") | |
=> #<MiniTest::Mock:0x007fc48ca57d70 @expected_calls={:abc=>{:retval=>"123", :args=>[]}}, @actual_calls={}> | |
>> mock.respond_to? :abc | |
=> true | |
>> mock.abc | |
=> "123" | |
>> mock2 = MiniTest::Mock.new | |
=> #<MiniTest::Mock:0x007fc48ca61f78 @expected_calls={}, @actual_calls={}> | |
>> mock2.respond_to? :abc | |
=> false | |
>> mock2.abc | |
NoMethodError: unmocked method :abc, expected one of [] | |
from /Users/cfcosta/.rbenv/versions/1.9.3-p125-perf/lib/ruby/1.9.1/minitest/mock.rb:82:in `method_missing' | |
from (irb):9 | |
from /Users/cfcosta/.rbenv/versions/1.9.3-p125-perf/bin/irb:12:in `<main>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment