Sha256: 54ce29c73537861035450a831cd5251e938a15e7df22d7d242af4ae68f612b9b

Contents?: true

Size: 801 Bytes

Versions: 12

Compression:

Stored size: 801 Bytes

Contents

RSpec.describe Evil::Client::ResponseError, "#message" do
  let(:error)    { described_class.new schema, settings, response }
  let(:schema)   { "Test::Api.users.get" }
  let(:settings) { :my_settings }
  let(:response) { [422, { "Language" => "en" }, ["something has got wrong"]] }

  subject { error.message }

  it "builds a proper error message" do
    expect(error.message).to eq "remote API responded to Test::Api.users.get" \
                                " with unexpected status 422"
  end

  it "handles proper data" do
    expect(error.schema).to   eq schema
    expect(error.settings).to eq settings
    expect(error.response).to eq response
    expect(error.status).to   eq response[0]
    expect(error.headers).to  eq response[1]
    expect(error.body).to     eq response[2]
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
evil-client-3.2.0 spec/unit/exceptions/response_error_spec.rb
evil-client-3.1.0 spec/unit/exceptions/response_error_spec.rb
evil-client-3.0.4 spec/unit/exceptions/response_error_spec.rb
evil-client-3.0.3 spec/unit/exceptions/response_error_spec.rb
evil-client-3.0.2 spec/unit/exceptions/response_error_spec.rb
evil-client-3.0.1 spec/unit/exceptions/response_error_spec.rb
evil-client-3.0.0 spec/unit/exceptions/response_error_spec.rb
evil-client-2.1.1 spec/unit/exceptions/response_error_spec.rb
evil-client-2.1.0 spec/unit/exceptions/response_error_spec.rb
evil-client-2.0.0 spec/unit/exceptions/response_error_spec.rb
evil-client-1.1.0 spec/unit/exceptions/response_error_spec.rb
evil-client-1.0.0 spec/unit/exceptions/response_error_spec.rb