Skip to content

Instantly share code, notes, and snippets.

@phiggins
Created May 19, 2011 19:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save phiggins/981546 to your computer and use it in GitHub Desktop.
Save phiggins/981546 to your computer and use it in GitHub Desktop.
Minimock Example
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