Sha256: eecc6d736725022322102d96e7da4e16647b0820499c24b1620c157693a4016b
Contents?: true
Size: 1.49 KB
Versions: 5
Compression:
Stored size: 1.49 KB
Contents
require "spec_helper" module Sucker describe "Item lookup" 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", "OfferFull"] } Sucker.stub(@worker) end context "single item" do before do @worker << { "ItemId" => "0816614024" } @response = @worker.get @item = @response.node("Item").first end it "returns an item" do @item.should be_an_instance_of Hash end it "includes an ASIN string" do @item["ASIN"].should eql "0816614024" end it "includes requested response groups" do @item["ItemAttributes"].should be_an_instance_of Hash @item["Offers"].should be_an_instance_of Hash end it "returns no errors" do @response.node("Error").should be_empty @response.node("Error").should be_an_instance_of Array end end context "multiple items" do before do @worker << { "ItemId" => ["0816614024", "0143105825"] } @items = @worker.get.node("Item") end it "returns two items" do @items.should be_an_instance_of Array @items.size.should eql 2 end end end end
Version data entries
5 entries across 5 versions & 1 rubygems