Sha256: 16d02224fb70a517087273ec9503256ad9dc9ef9d52cd8dbd1c6abf33da416b0

Contents?: true

Size: 938 Bytes

Versions: 2

Compression:

Stored size: 938 Bytes

Contents

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.find("Error")
      errors.size.should eql 2
      errors.first["Message"].should include "not a valid value"
    end

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

Version data entries

2 entries across 2 versions & 1 rubygems

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