Sha256: 2d48f2f300ae113df348fe380aa4e8cf8bf5154b0cc75fd5fa42637e82bad27a

Contents?: true

Size: 954 Bytes

Versions: 5

Compression:

Stored size: 954 Bytes

Contents

require "spec_helper"

module Sucker
  describe "Errors" do
    before do
      worker = Sucker.new(
        :locale => "us",
        :key    => amazon["key"],
        :secret => amazon["secret"])

      # worker.curl { |curl| curl.verbose = true }

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

      Sucker.stub(worker)

      # The first ASIN exists, the latter two do not.
      worker << { "ItemId" => ["0816614024", "0007218095", "0007218176"] }
      @response = 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

5 entries across 5 versions & 1 rubygems

Version Path
sucker-0.9.2 spec/integration/errors_spec.rb
sucker-0.9.1 spec/integration/errors_spec.rb
sucker-0.9.0 spec/integration/errors_spec.rb
sucker-0.8.0 spec/integration/errors_spec.rb
sucker-0.7.1 spec/integration/errors_spec.rb