Sha256: eabd5c985e32c3a0d50336f457a0666b57d95158175f670c658fb2cd91e6ca30

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

# encoding: utf-8
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.node("RelatedItem").size.should eql 1
        parent_asin = response.node("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.node("RelatedItem").size.should > 1
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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