Sha256: a122079e2af0edce4126024a3ccbd3166d25f52b163d3abccca32fd45f5cfdb4

Contents?: true

Size: 793 Bytes

Versions: 1

Compression:

Stored size: 793 Bytes

Contents

require File.expand_path('../../spec_helper', __FILE__)

describe Faraday::Response do

  before do
    @client = Genability::Client.new({:application_id => 'ValidAppID', :application_key => 'ValidAppKey'})
  end

  {
    400 => Genability::BadRequest,
    403 => Genability::Forbidden,
    404 => Genability::NotFound,
    500 => Genability::ServerError,
    503 => Genability::ServiceUnavailable
  }.each do |status, exception|
    context "when HTTP status is #{status}" do

      before do
        stub_get('lses.json?appId=ValidAppID&appKey=ValidAppKey').
          to_return(:status => status)
      end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
genability-0.1.0 spec/faraday/response_spec.rb