Sha256: 2564da65e035fbe8c1257236a176e726c047b81b23555cb0d8a2ab8a380255e1

Contents?: true

Size: 886 Bytes

Versions: 7

Compression:

Stored size: 886 Bytes

Contents

require 'helper'

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

  {
    400 => Faraday::Error::ClientError,
    401 => Faraday::Error::ClientError,
    403 => Faraday::Error::ClientError,
    404 => Faraday::Error::ResourceNotFound,
    406 => Faraday::Error::ClientError,
    500 => Faraday::Error::ClientError,
    501 => Faraday::Error::ClientError,
    502 => Faraday::Error::ClientError,
    503 => Faraday::Error::ClientError,
  }.each do |status, exception|
    context "when HTTP status is #{status}" do

      before do
        stub_get("api/v1/careers/11-1011-01.json").
          to_return(:status => status, :body => fixture("career.json"))
      end

      it "should raise #{exception.name} error" do
        lambda do
          @client.career("11-1011.01")
        end.should raise_error exception
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
futures_pipeline-0.2.1 spec/faraday/response_spec.rb
futures_pipeline-0.2.0 spec/faraday/response_spec.rb
futures_pipeline-0.1.2 spec/faraday/response_spec.rb
futures_pipeline-0.1.1 spec/faraday/response_spec.rb
futures_pipeline-0.1.0 spec/faraday/response_spec.rb
futures_pipeline-0.0.4 spec/faraday/response_spec.rb
futures_pipeline-0.0.3 spec/faraday/response_spec.rb