Sha256: 9057a2620f0dfdac64eb4c8fbc1e982d547addfb51d7092fb79513454277529f

Contents?: true

Size: 607 Bytes

Versions: 8

Compression:

Stored size: 607 Bytes

Contents

RSpec.describe SolidusBacktracs::Api::RequestError do
  describe '.from_response' do
    it 'extracts the status code, body and headers from the response' do
      response = instance_double(
        'HTTParty::Response',
        code: 500,
        headers: { 'Key' => 'Value' },
        body: '{ "message": "Internal Server Error" }',
      )

      error = described_class.from_response(response)

      expect(error).to have_attributes(
        response_code: 500,
        response_headers: { 'Key' => 'Value' },
        response_body: '{ "message": "Internal Server Error" }',
      )
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
solidus_bactracs-3.0.0 spec/lib/solidus_backtracs/api/request_error_spec.rb
solidus_backtracs-2.2.6 spec/lib/solidus_backtracs/api/request_error_spec.rb
solidus_backtracs-2.2.5 spec/lib/solidus_backtracs/api/request_error_spec.rb
solidus_backtracs-2.2.4 spec/lib/solidus_backtracs/api/request_error_spec.rb
solidus_backtracs-2.2.3 spec/lib/solidus_backtracs/api/request_error_spec.rb
solidus_backtracs-2.2.2 spec/lib/solidus_backtracs/api/request_error_spec.rb
solidus_backtracs-2.2.1 spec/lib/solidus_backtracs/api/request_error_spec.rb
solidus_backtracs-2.2.0 spec/lib/solidus_backtracs/api/request_error_spec.rb