Sha256: 4a68774b66b8c053a9d6dcfccbf3873674d48ee0bf8aee77ace66c33a642b5b3

Contents?: true

Size: 899 Bytes

Versions: 4

Compression:

Stored size: 899 Bytes

Contents

# frozen_string_literal: true

require 'helper'
require 'peddler/headers'

class TestPeddlerHeaders < MiniTest::Test
  include ::Peddler::Headers

  attr_reader :headers

  def setup
    @headers = {
      'x-mws-quota-max' => '200.0',
      'x-mws-quota-remaining' => '200.0',
      'x-mws-quota-resetsOn' => '2017-01-30T00:03:00.000Z',
      'x-mws-request-id' => '123',
      'x-mws-timestamp' => '2017-01-29T23:55:25.356Z',
      'x-mws-response-context' => 'foo'
    }
  end

  def test_quota
    assert quota
    assert_kind_of Integer, quota.max
    assert_kind_of Integer, quota.remaining
    assert_kind_of Time, quota.resets_on
  end

  def test_request_id
    assert request_id
  end

  def test_timestamp
    assert_kind_of Time, timestamp
  end

  def test_response_context
    assert response_context
  end

  def test_handles_no_quota
    @headers = {}
    assert_nil quota
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
peddler-1.6.7 test/unit/peddler/test_headers.rb
peddler-1.6.6 test/unit/peddler/test_headers.rb
peddler-1.6.5 test/unit/peddler/test_headers.rb
peddler-1.6.4 test/unit/peddler/test_headers.rb