Sha256: 9b2ace666358f6edb55e2f31799f8bf50d07fe3508b989544fcc54d453c768d3

Contents?: true

Size: 1.12 KB

Versions: 8

Compression:

Stored size: 1.12 KB

Contents

require "helper"

describe Alexa::API::CategoryListings do
  it "raises argument error when path not present" do
    assert_raises Alexa::ArgumentError, /path/ do
      Alexa::API::CategoryListings.new(:access_key_id => "fake", :secret_access_key => "fake").fetch
    end
  end

  describe "parsing xml" do
    before do
      stub_request(:get, %r{http://awis.amazonaws.com}).to_return(fixture("category_listings/card_games.txt"))
      @category_listings = Alexa::API::CategoryListings.new(:access_key_id => "fake", :secret_access_key => "fake")
      @category_listings.fetch(:path => "Top/Games/Card_Games")
    end

    it "returns recursive count" do
      assert_equal 1051, @category_listings.recursive_count
    end

    it "returns count" do
      assert_equal 1, @category_listings.count
    end

    it "returns listings" do
      assert_equal 20, @category_listings.listings.size
    end

    it "has success status code" do
      assert_equal "Success", @category_listings.status_code
    end

    it "has request id" do
      assert_equal "a069b6cd-309f-df52-88be-1bd88ab45b7e", @category_listings.request_id
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
alexa-0.6.3 test/api/category_listings_test.rb
alexa-0.6.2 test/api/category_listings_test.rb
alexa-0.6.1 test/api/category_listings_test.rb
alexa-0.6.0 test/api/category_listings_test.rb
alexa-0.5.1 test/api/category_listings_test.rb
alexa-0.5.0 test/api/category_listings_test.rb
alexa-0.4.2 test/api/category_listings_test.rb
alexa-0.4.1 test/api/category_listings_test.rb