spec/integration/item_search_spec.rb in sucker-0.9.2 vs spec/integration/item_search_spec.rb in sucker-1.0.0.beta.1
- old
+ new
@@ -1,34 +1,38 @@
+# encoding: utf-8
+
# http://github.com/papercavalier/sucker/issues#issue/2
require "spec_helper"
module Sucker
describe "Item Search" do
- before do
- @worker = Sucker.new(
+ use_vcr_cassette "integration/item_search", :record => :new_episodes
+
+ let(:worker) do
+ worker = Sucker.new(
:locale => "us",
:key => amazon["key"],
:secret => amazon["secret"])
- @worker << {
+ worker << {
"Operation" => "ItemSearch",
"SearchIndex" => "Books",
"Author" => "Orwell" }
-
- #Sucker.stub(@worker)
+ worker
end
it "works for Orwell" do
- @worker.get.should be_valid
+ worker.get.should be_valid
end
it "works for George Orwell, too" do
- @worker << {
+ worker << {
"Operation" => "ItemSearch",
"SearchIndex" => "Books",
"Author" => "George Orwell" }
- response = @worker.get
+
+ response = worker.get
response.should be_valid
response.node("TotalPages").first.should be_an_instance_of String
end
end
end