Sha256: 880937043354b0944efcea6baefbfb9684974ce55cff2e3a3169abfc023ac909

Contents?: true

Size: 665 Bytes

Versions: 8

Compression:

Stored size: 665 Bytes

Contents

RSpec.describe SolidusBacktracs::Api::RateLimitedError do
  describe '.from_response' do
    it 'extracts the status code, body, headers and retry time from the response' do
      response = instance_double(
        'HTTParty::Response',
        code: 429,
        headers: { 'X-Rate-Limit-Reset' => 20 },
        body: '{ "message": "Too Many Requests" }',
      )

      error = described_class.from_response(response)

      expect(error).to have_attributes(
        response_code: 429,
        response_headers: { 'X-Rate-Limit-Reset' => 20 },
        response_body: '{ "message": "Too Many Requests" }',
        retry_in: 20.seconds,
      )
    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/rate_limited_error_spec.rb
solidus_backtracs-2.2.6 spec/lib/solidus_backtracs/api/rate_limited_error_spec.rb
solidus_backtracs-2.2.5 spec/lib/solidus_backtracs/api/rate_limited_error_spec.rb
solidus_backtracs-2.2.4 spec/lib/solidus_backtracs/api/rate_limited_error_spec.rb
solidus_backtracs-2.2.3 spec/lib/solidus_backtracs/api/rate_limited_error_spec.rb
solidus_backtracs-2.2.2 spec/lib/solidus_backtracs/api/rate_limited_error_spec.rb
solidus_backtracs-2.2.1 spec/lib/solidus_backtracs/api/rate_limited_error_spec.rb
solidus_backtracs-2.2.0 spec/lib/solidus_backtracs/api/rate_limited_error_spec.rb