Sha256: 41b6e16a8e543d895adcf8a36178e438e7aeb0daa0b3648dcaa94be5f38d1e8f

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

require "spec_helper"

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

      worker << {
        "Operation"         => "ItemLookup",
        "IdType"            => "ASIN",
        "ResponseGroup"     => ["RelatedItems"],
        "RelationshipType"  => "AuthorityTitle" }

      worker
    end

    context "Child" do
      use_vcr_cassette "integration/related_items/child", :record => :new_episodes

      it "finds parent and related items" do
        worker << { "ItemId" => "0415246334" }
        response = worker.get
        response.find("RelatedItem").size.should eql 1
        parent_asin = response.find("RelatedItem").first["Item"]["ASIN"]
      end
    end

    context "Parent" do
      use_vcr_cassette "integration/related_items/parent", :record => :new_episodes

      it "finds related items" do
        worker << { "ItemId" => "B000ASPUES" }
        response = worker.get
        response.find("RelatedItem").size.should > 1
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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