Sha256: c0059e82b622cb41a5488bc3e34d06070dde86fcbc5c54a1a2d81bf14d8448ec

Contents?: true

Size: 803 Bytes

Versions: 4

Compression:

Stored size: 803 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,
    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('user/show/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

4 entries across 4 versions & 2 rubygems

Version Path
hybridgroup-octokit-0.6.3 spec/faraday/response_spec.rb
hybridgroup-octokit-0.6.2 spec/faraday/response_spec.rb
hybridgroup-octokit-0.6.1 spec/faraday/response_spec.rb
xn-octokit-0.6.1 spec/faraday/response_spec.rb