Created
May 19, 2011 19:35
-
-
Save phiggins/981546 to your computer and use it in GitHub Desktop.
Minimock Example
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
require 'minitest/mock' | |
require 'net/http' | |
m = MiniTest::Mock.new.expect(:foo, true, [Net::HTTP::Post.new("/")]) | |
p m.foo(1) | |
begin | |
m.verify | |
rescue Exception => e | |
p [:exception, e.class, :message, e.message] | |
end | |
m = MiniTest::Mock.new.expect(:bar, true, [Net::HTTP::Post.new("/")]) | |
p m.bar(Net::HTTP::Post.new("/")) | |
begin | |
m.verify | |
rescue Exception => e | |
p [:exception, e.class, :message, e.message] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment