Sha256: 9d17037e23f7dd841cc3c880d7dcb4068bcb34ad024b6209ec06b9cae2312e2f

Contents?: true

Size: 781 Bytes

Versions: 2

Compression:

Stored size: 781 Bytes

Contents

require 'spec_helper'

module Kosher
  describe Item do
    describe ".build" do
      use_vcr_cassette '0143105825'

      let(:asin) { '0143105825' }

      let(:response) do
        request = Request.new(credentials)
        request.locale = :us
        request.batchify([asin])
        algorithm = request.get

        algorithm.instance_variable_get(:@response)
      end

      let(:item) do
        doc = response.find('Item').first
        Item.build(doc)
      end

      it "should build an item" do
        item.should be_a Item
        item.asin.should eql asin
        item.sales_rank.should be > 0
      end

      it "should build the offers of an item" do
        item.offers.count.should > 0
        item.offers.first.should be_a Offer
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kosher-0.1.4 spec/kosher/item_spec.rb
kosher-0.1.3 spec/kosher/item_spec.rb