Sha256: ee162b6987671690067351dd9188f65d2d6744064ab843a134a7cdaf9542881b

Contents?: true

Size: 956 Bytes

Versions: 1

Compression:

Stored size: 956 Bytes

Contents

# encoding: utf-8
require "spec_helper"

module Sucker
  describe "Errors" do
    use_vcr_cassette "integration/errors", :record => :new_episodes

    let(:response) do
      worker = Sucker.new(
        :locale => "us",
        :key    => amazon["key"],
        :secret => amazon["secret"])

      worker << {
        "Operation"     => "ItemLookup",
        "IdType"        => "ASIN",
        "Condition"     => "All",
        "MerchantId"    => "All",
        "ResponseGroup" => ["ItemAttributes"] }

      # The first ASIN exists, the latter two do not.
      worker << { "ItemId" => ["0816614024", "0007218095", "0007218176"] }
      worker.get
    end

    it "returns two errors" do
      errors = response.node("Error")
      errors.size.should eql 2
      errors.first["Message"].should include "not a valid value"
    end

    it "returns one item" do
      items = response.node("ItemAttributes")
      items.size.should eql 1
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sucker-1.0.0.beta.1 spec/integration/errors_spec.rb