Sha256: 4a0a675a63b3c6397c26d3a0f5fa8506d3ff963e9cf4d70c6e5047e346a243d7
Contents?: true
Size: 871 Bytes
Versions: 1
Compression:
Stored size: 871 Bytes
Contents
require 'helper' describe Faraday::Response do before do @client = Assistly::Client.new end { 400 => Assistly::BadRequest, 401 => Assistly::Unauthorized, 403 => Assistly::Forbidden, 404 => Assistly::NotFound, 406 => Assistly::NotAcceptable, 420 => Assistly::EnhanceYourCalm, 500 => Assistly::InternalServerError, 502 => Assistly::BadGateway, 503 => Assistly::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'=>'Assistly Ruby Gem 0.1'}). 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
assistly-0.1.1 | spec/faraday/response_spec.rb |