vendor/rack/test/spec_rack_response.rb in relevance-castronaut-0.5.4 vs vendor/rack/test/spec_rack_response.rb in relevance-castronaut-0.6.0

- old
+ new

@@ -1,23 +1,24 @@ require 'test/spec' +require 'set' require 'rack/response' context "Rack::Response" do specify "has sensible default values" do response = Rack::Response.new status, header, body = response.finish status.should.equal 200 - header.should.equal "Content-Type" => "text/html" + header.should.equal "Content-Type" => "text/html", "Content-Length" => "0" body.each { |part| part.should.equal "" } response = Rack::Response.new status, header, body = *response status.should.equal 200 - header.should.equal "Content-Type" => "text/html" + header.should.equal "Content-Type" => "text/html", "Content-Length" => "0" body.each { |part| part.should.equal "" } end @@ -60,10 +61,16 @@ response.set_cookie "foo", {:value => "bar", :expires => Time.now+10} response["Set-Cookie"].should.match( /expires=..., \d\d-...-\d\d\d\d \d\d:\d\d:\d\d .../) end + specify "can set secure cookies" do + response = Rack::Response.new + response.set_cookie "foo", {:value => "bar", :secure => true} + response["Set-Cookie"].should.equal "foo=bar; secure" + end + specify "can delete cookies" do response = Rack::Response.new response.set_cookie "foo", "bar" response.set_cookie "foo2", "bar2" response.delete_cookie "foo" @@ -80,10 +87,10 @@ r = Rack::Response.new(["foo", "bar"]) status, header, body = r.finish str = ""; body.each { |part| str << part } str.should.equal "foobar" - r = Rack::Response.new({"foo", "bar"}) + r = Rack::Response.new(["foo", "bar"].to_set) r.write "foo" status, header, body = r.finish str = ""; body.each { |part| str << part } str.should.equal "foobarfoo"