Sha256: b6bf00b2b709b30b59d0f643a718e102c159894c26f403aba125f33b4edfa2de
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
require 'spec_helper' describe Faraday::Response::RaiseRapidashError do context "successful response" do let(:env) { { :status => '200' } } it "should not raise an exception" do expect { subject.on_complete(env) }.to_not raise_exception end end context "error response" do let(:env) { { :status => '404', :method => 'post', :url => 'http://acme.com/api/posts' } } it "should raise an exception" do expect { subject.on_complete(env) }.to raise_exception(Rapidash::ResponseError) end describe "custom reponse error" do before :each do class MyCustomResponseError < Rapidash::ResponseError; end Rapidash.response_exception_class = MyCustomResponseError end it "should raise a custom excpetion class if specified" do expect { subject.on_complete(env) }.to raise_exception(MyCustomResponseError) end after :each do Rapidash.response_exception_class = nil end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rapidash-0.4.0 | spec/faraday/raise_rapidash_error_spec.rb |