spec/unit/sucker/request_spec.rb in sucker-0.2.1 vs spec/unit/sucker/request_spec.rb in sucker-0.2.2
- old
+ new
@@ -52,10 +52,17 @@
it "returns a hash" do
@worker.get.should be_an_instance_of Hash
end
end
+ context "#key=" do
+ it "sets the Amazon AWS access key in the parameters" do
+ @worker.key = "key"
+ @worker.parameters["AWSAccessKeyId"].should eql "key"
+ end
+ end
+
context "private methods" do
context "#build_query" do
it "canonicalizes parameters" do
query = @worker.send(:build_query)
query.should eql "Service=AWSECommerceService&Version=#{Sucker::AMAZON_API_VERSION}"
@@ -72,40 +79,21 @@
query = @worker.send(:build_query)
query.should match /^Foo=bar%2Cbaz/
end
end
- context "#digest" do
- it "returns a digest object" do
- @worker.send(:digest).should be_an_instance_of OpenSSL::Digest::Digest
- end
- end
-
- context "#key=" do
- it "sets the Amazon AWS access key in the parameters" do
- @worker.key = "key"
- @worker.parameters["AWSAccessKeyId"].should eql "key"
- end
- end
-
context "#host" do
it "returns a host" do
@worker.locale = "us"
@worker.send(:host).should eql "ecs.amazonaws.com"
end
end
- context "#path" do
- it "returns a path" do
- @worker.send(:path).should eql "/onca/xml"
- end
- end
-
- context "#sign_query" do
+ context "#build_signed_query" do
it "returns a signed query string" do
@worker.secret = "secret"
@worker.locale = "us"
- query = @worker.send :sign_query
+ query = @worker.send :build_signed_query
query.should match /&Signature=.*/
end
end
context "#timestamp_parameters" do