test/connection_test.rb in alexa-0.6.0 vs test/connection_test.rb in alexa-0.6.1
- old
+ new
@@ -15,9 +15,18 @@
expected = "AWSAccessKeyId=fake&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-08-08T20%3A58%3A32.000Z&Version=2005-07-11&custom_value=3"
assert_equal expected, connection.query
end
+ it "encodes space character" do
+ connection = Alexa::Connection.new(:access_key_id => "fake", :secret_access_key => "fake")
+ connection.stubs(:timestamp).returns("2012-08-08T20:58:32.000Z")
+ connection.params = {:custom_value => "two beers"}
+
+ expected = "AWSAccessKeyId=fake&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-08-08T20%3A58%3A32.000Z&Version=2005-07-11&custom_value=two%20beers"
+ assert_equal expected, connection.query
+ end
+
it "raises error when unathorized" do
stub_request(:get, %r{http://awis.amazonaws.com}).to_return(fixture("unathorized.txt"))
connection = Alexa::Connection.new(:access_key_id => "wrong", :secret_access_key => "wrong")
assert_raises Alexa::ResponseError do