spec/session_spec.rb in patron-0.4.17 vs spec/session_spec.rb in patron-0.4.18
- old
+ new
@@ -128,10 +128,18 @@
response = @session.copy("/test", "/test2")
body = YAML::load(response.body)
body.header['destination'].first.should == "/test2"
end
+ it "should upload data with :get" do
+ data = "upload data"
+ response = @session.request(:get, "/test", {}, :data => data)
+ body = YAML::load(response.body)
+ body.request_method.should == "GET"
+ body.header['content-length'].should == [data.size.to_s]
+ end
+
it "should upload data with :put" do
data = "upload data"
response = @session.put("/test", data)
body = YAML::load(response.body)
body.request_method.should == "PUT"
@@ -265,17 +273,17 @@
body = YAML::load(response.body)
}.should_not raise_error
body.request_method.should == "GET"
end
-
+
it "should serialize query params and append them to the url" do
response = @session.request(:get, "/test", {}, :query => {:foo => "bar"})
request = YAML::load(response.body)
request.parse
(request.path + '?' + request.query_string).should == "/test?foo=bar"
end
-
+
it "should merge parameters in the :query option with pre-existing query parameters" do
response = @session.request(:get, "/test?foo=bar", {}, :query => {:baz => "quux"})
request = YAML::load(response.body)
request.parse
(request.path + '?' + request.query_string).should == "/test?foo=bar&baz=quux"