Sha256: e4fc68e0643024584aab537d39bbc7cf485fe6598ffc0e0e3b98bf5d8f9e6a54

Contents?: true

Size: 858 Bytes

Versions: 33

Compression:

Stored size: 858 Bytes

Contents

# -*- encoding: utf-8 -*-
require 'helper'

describe Faraday::Response do
  before do
    @client = Octokit::Client.new
  end

  {
    400 => Octokit::BadRequest,
    401 => Octokit::Unauthorized,
    403 => Octokit::Forbidden,
    404 => Octokit::NotFound,
    406 => Octokit::NotAcceptable,
    422 => Octokit::UnprocessableEntity,
    500 => Octokit::InternalServerError,
    501 => Octokit::NotImplemented,
    502 => Octokit::BadGateway,
    503 => Octokit::ServiceUnavailable,
  }.each do |status, exception|
    context "when HTTP status is #{status}" do

      before do
        stub_get('https://api.github.com/users/sferik').
          to_return(:status => status)
      end

      it "should raise #{exception.name} error" do
        lambda do
          @client.user('sferik')
        end.should raise_error(exception)
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
octokit-1.15.1 spec/faraday/response_spec.rb
octokit-1.15.0 spec/faraday/response_spec.rb
octokit-1.14.0 spec/faraday/response_spec.rb
octokit-1.13.0 spec/faraday/response_spec.rb
octokit-1.12.0 spec/faraday/response_spec.rb
octokit-1.11.0 spec/faraday/response_spec.rb
octokit-1.10.0 spec/faraday/response_spec.rb
octokit-1.9.4 spec/faraday/response_spec.rb
octokit-1.9.3 spec/faraday/response_spec.rb
octokit-1.9.2 spec/faraday/response_spec.rb
octokit-1.9.1 spec/faraday/response_spec.rb
octokit-1.8.1 spec/faraday/response_spec.rb
octokit-1.8.0 spec/faraday/response_spec.rb
octokit-1.7.0 spec/faraday/response_spec.rb
octokit-1.6.1 spec/faraday/response_spec.rb
octokit-1.6.0 spec/faraday/response_spec.rb
octokit-1.5.0 spec/faraday/response_spec.rb
octokit-1.4.0 spec/faraday/response_spec.rb
octokit-1.3.0 spec/faraday/response_spec.rb
octokit-1.2.1 spec/faraday/response_spec.rb