Skip to content

Instantly share code, notes, and snippets.

@hypomodern
Created April 1, 2012 23:39
Show Gist options
  • Save hypomodern/2279482 to your computer and use it in GitHub Desktop.
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
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
@hypomodern
Copy link
Author

If there's an easier/less LoC way to do this, I'm all ears.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment