Sha256: 66df4a3d2ddc67166af97c254275f5bff53f4a8820d201d2058da1e178f7d1af

Contents?: true

Size: 652 Bytes

Versions: 7

Compression:

Stored size: 652 Bytes

Contents

# frozen_string_literal: true

RSpec.describe SoapyCake::RequestFailed do
  it 'has request related attributes' do
    error = described_class.new(
      'Boo!',
      request_path: 'request path',
      request_body: 'request body',
      response_body: 'response body'
    )
    expect(error).to have_attributes(
      'request_path' => 'request path',
      'request_body' => 'request body',
      'response_body' => 'response body'
    )
  end

  it 'redacts the API key from the request body' do
    error = described_class.new('Boo!', request_body: ">#{ENV.fetch('CAKE_API_KEY')}<")
    expect(error.request_body).to eq('>[redacted]<')
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
soapy_cake-2.3.1 spec/lib/soapy_cake/request_failed_spec.rb
soapy_cake-2.3.0 spec/lib/soapy_cake/request_failed_spec.rb
soapy_cake-2.2.7 spec/lib/soapy_cake/request_failed_spec.rb
soapy_cake-2.2.6 spec/lib/soapy_cake/request_failed_spec.rb
soapy_cake-2.2.5 spec/lib/soapy_cake/request_failed_spec.rb
soapy_cake-2.2.4 spec/lib/soapy_cake/request_failed_spec.rb
soapy_cake-2.2.3 spec/lib/soapy_cake/request_failed_spec.rb