spec/session_spec.rb in patron-0.6.5 vs spec/session_spec.rb in patron-0.7.0
- old
+ new
@@ -246,9 +246,20 @@
body = YAML::load(response.body)
expect(body.request_method).to be == "PUT"
expect(body.header['content-length']).to be == [data.size.to_s]
end
+ it "should upload a Tempfile with :put" do
+ data = Tempfile.new 'data-buffer'
+ data << Random.new.bytes(1024 * 64)
+ data.flush; data.rewind
+
+ response = @session.put("/test", data, {'Expect' => ''})
+ body = YAML::load(response.body)
+ expect(body.request_method).to be == "PUT"
+ expect(body.header['content-length']).to be == [data.size.to_s]
+ end
+
it "should upload data with :patch" do
data = "upload data"
response = @session.patch("/testpatch", data)
body = YAML::load(response.body)
expect(body["body"]).to eq("upload data")