-
-
Save bhenderson/984275 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 | |
puts "expected to raise" | |
p [:exception, e.class, :message, e.message] | |
end | |
m = MiniTest::Mock.new.expect(:bar, true, [Net::HTTP::Post]) | |
p m.bar(Net::HTTP::Post.new("/")) | |
p m.verify | |
puts "not expected to raise" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment