spec/session_spec.rb in patron-0.6.3 vs spec/session_spec.rb in patron-0.6.4

- old
+ new

@@ -105,9 +105,22 @@ expect(response.body).to be_nil expect(File.size(File.join(File.dirname(__FILE__),"../pic.png"))).to be == File.size(tmpfile) FileUtils.rm tmpfile end + it "should not send the user-agent if it has been deleted from headers" do + @session.headers.delete 'User-Agent' + response = @session.get("/test") + body = YAML::load(response.body) + expect(body.header["user-agent"]).to be_nil + end + + it "should set the default User-agent" do + response = @session.get("/test") + body = YAML::load(response.body) + expect(body.header["user-agent"]).to be == [Patron.user_agent_string] + end + it "should include custom headers in a request" do response = @session.get("/test", {"User-Agent" => "PatronTest"}) body = YAML::load(response.body) expect(body.header["user-agent"]).to be == ["PatronTest"] end