test/amazon/item_test.rb in amazon-associates-0.6.3 vs test/amazon/item_test.rb in amazon-associates-0.7.0
- old
+ new
@@ -1,9 +1,18 @@
-require File.join(File.dirname(__FILE__), '../test_helper')
+# encoding: utf-8
+require_relative '../test_helper'
module Amazon
module Associates
+ class ItemActiveModelTest < Test::Unit::TestCase
+ include ActiveModel::Lint::Tests
+
+ def setup
+ @model = Amazon::Associates.item_search('ruby').items.first
+ end
+ end
+
class ItemTest < Test::Unit::TestCase
include FilesystemTestHelper
## Test item_search
def setup
@@ -30,11 +39,11 @@
end
def test_item_search_with_paging
resp = Amazon::Associates.item_search('ruby', :item_page => 2)
assert resp.request.valid?
- assert 2, resp.current_page
+ assert_equal 2, resp.current_page
end
def test_item_search_with_response_group_array
resp = Amazon::Associates.item_search('ruby', :response_group => %w{Small ItemAttributes Images})
assert resp.request.valid?
@@ -171,11 +180,11 @@
def test_hpricot_extensions
item = Amazon::Associates.item_lookup('0974514055').item
assert_equal "Programming Ruby: The Pragmatic Programmers' Guide, Second Edition", item.attributes['Title']
assert item.authors.is_a?(Array)
- assert 3, item.authors.size
+ assert_equal 3, item.authors.size
assert_equal "Dave Thomas", item.authors.first
end
end
class Amazon::Associates::ItemTestsBroughtInFromAssociateGem < Test::Unit::TestCase
@@ -195,11 +204,11 @@
end
def test_item_search_with_paging
resp = Amazon::Associates.item_search("ruby", :item_page => 2)
assert resp.request.valid?, resp.inspect
- assert 2, resp.current_page
+ assert_equal 2, resp.current_page
end
def test_item_search_with_no_result
assert_raise(Amazon::Associates::ItemNotFound) do
Amazon::Associates.item_search("afdsafds")
@@ -259,10 +268,10 @@
title = resp.items.first.attributes['Title']
authors = resp.items.first.authors
assert_equal "Programming Ruby: The Pragmatic Programmers' Guide, Second Edition", title
assert authors.is_a?(Array)
- assert 3, authors.size
+ assert_equal 3, authors.size
assert_equal "Dave Thomas", authors.first
end
end
class ItemTestBroughtIn < Test::Unit::TestCase
\ No newline at end of file