Sha256: b9c2ea35707fbf9fb19bcb99c3283433a8f455f3138d1263a24aa9f11a9f8eb9

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

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_mws_quota_max
    assert_kind_of Integer, mws_quota_max
  end

  def test_mws_quota_remaining
    assert_kind_of Integer, mws_quota_remaining
  end

  def test_mws_quota_resets_on
    assert_kind_of Time, mws_quota_resets_on
  end

  def test_request_id
    assert mws_request_id
  end

  def test_timestamp
    assert_kind_of Time, mws_timestamp
  end

  def test_response_context
    assert mws_response_context
  end

  def test_handling_no_quota
    @headers = {}
    assert_nil mws_quota_max
    assert_nil mws_quota_remaining
    assert_nil mws_quota_resets_on
    assert_nil mws_request_id
    assert_nil mws_timestamp
    assert_nil mws_response_context
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
peddler-2.1.0 test/unit/peddler/test_headers.rb