Sha256: 2d8ad596ae112e4fa9297a8cc61fca6a83552400f92dd202ed7b646b26ee29c7
Contents?: true
Size: 847 Bytes
Versions: 4
Compression:
Stored size: 847 Bytes
Contents
require 'helper' describe Faraday::Response do before do @client = Desk::Client.new end { 400 => Desk::BadRequest, 401 => Desk::Unauthorized, 403 => Desk::Forbidden, 404 => Desk::NotFound, 406 => Desk::NotAcceptable, 420 => Desk::EnhanceYourCalm, 500 => Desk::InternalServerError, 502 => Desk::BadGateway, 503 => Desk::ServiceUnavailable, }.each do |status, exception| context "when HTTP status is #{status}" do before do stub_get('users/1.json'). with(:headers => {'Accept'=>'application/json', 'User-Agent'=>Desk::Configuration::DEFAULT_USER_AGENT}). to_return(:status => status) end it "should raise #{exception.name} error" do lambda do @client.user(1) end.should raise_error(exception) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
desk-0.3.3 | spec/faraday/response_spec.rb |
desk-0.3.2 | spec/faraday/response_spec.rb |
desk-0.3.1 | spec/faraday/response_spec.rb |
desk-0.3.0 | spec/faraday/response_spec.rb |