Sha256: a29770db65d73ff3dd2a97a364e3f655100c2a1b755ec5309100cbd6ebdf3c7a

Contents?: true

Size: 898 Bytes

Versions: 1

Compression:

Stored size: 898 Bytes

Contents

require 'minitest/autorun'
require 'minitest/pride'
require_relative '../lib/vacuum'

class TestVacuum < Minitest::Test
  include Vacuum

  def test_requires_valid_locale
    assert_raises(Request::BadLocale) { Request.new('foo') }
  end

  def test_defaults_to_us_endpoint
    assert_equal 'http://webservices.amazon.com/onca/xml', Request.new.aws_endpoint
  end

  def test_returns_url
    req = Request.new
    req.configure(aws_access_key_id: 'key', aws_secret_access_key: 'secret', associate_tag: 'tag')
    assert_match(/webservices.amazon.com.*Foo=Bar/, req.url('Foo' => 'Bar'))
  end

  def test_fetches_parsable_response
    Excon.stub({}, { body: '<foo>bar</foo>' })
    req = Request.new
    req.configure(aws_access_key_id: 'key', aws_secret_access_key: 'secret', associate_tag: 'tag')
    res = req.item_lookup({}, mock: true)
    refute_empty res.to_h
    Excon.stubs.clear
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vacuum-1.0.0 test/test_vacuum.rb