Sha256: 4647e2dbaec6de51f4f4d179aa3a77d0cd3ff274e506d9ff2e98152496af2619

Contents?: true

Size: 664 Bytes

Versions: 15

Compression:

Stored size: 664 Bytes

Contents

RSpec.describe SolidusBactracs::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

15 entries across 15 versions & 1 rubygems

Version Path
solidus_bactracs-4.0.1 spec/lib/solidus_bactracs/api/rate_limited_error_spec.rb
solidus_bactracs-4.0.0 spec/lib/solidus_bactracs/api/rate_limited_error_spec.rb
solidus_bactracs-3.5.2 spec/lib/solidus_bactracs/api/rate_limited_error_spec.rb
solidus_bactracs-3.5.1 spec/lib/solidus_bactracs/api/rate_limited_error_spec.rb
solidus_bactracs-3.5.0 spec/lib/solidus_bactracs/api/rate_limited_error_spec.rb
solidus_bactracs-3.4.0 spec/lib/solidus_bactracs/api/rate_limited_error_spec.rb
solidus_bactracs-3.3.2 spec/lib/solidus_bactracs/api/rate_limited_error_spec.rb
solidus_bactracs-3.3.1 spec/lib/solidus_bactracs/api/rate_limited_error_spec.rb
solidus_bactracs-3.3.0 spec/lib/solidus_bactracs/api/rate_limited_error_spec.rb
solidus_bactracs-3.2.2 spec/lib/solidus_bactracs/api/rate_limited_error_spec.rb
solidus_bactracs-3.2.1 spec/lib/solidus_bactracs/api/rate_limited_error_spec.rb
solidus_bactracs-3.2.0 spec/lib/solidus_bactracs/api/rate_limited_error_spec.rb
solidus_bactracs-3.1.2 spec/lib/solidus_bactracs/api/rate_limited_error_spec.rb
solidus_bactracs-3.1.1 spec/lib/solidus_bactracs/api/rate_limited_error_spec.rb
solidus_bactracs-3.1.0 spec/lib/solidus_bactracs/api/rate_limited_error_spec.rb