Created
April 1, 2012 23:39
-
-
Save hypomodern/2279482 to your computer and use it in GitHub Desktop.
What I'm currently doing to test behavior when an external service fails
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
client.stub!(:connection).and_return( | |
Faraday.new do |builder| | |
builder.adapter :test do |stub| | |
stub.get('laikal1.card') {[ 500, {}, 'Oh Noes! I blew it up!' ]} | |
end | |
end | |
) | |
VCR.turned_off do | |
response = client.fetch | |
response.status.should == 500 | |
response.body.should == 'Oh Noes! I blew it up!' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If there's an easier/less LoC way to do this, I'm all ears.