diff --git a/lib/rack/test/cookie_jar.rb b/lib/rack/test/cookie_jar.rb index 888729fd..c9fe035e 100644 --- a/lib/rack/test/cookie_jar.rb +++ b/lib/rack/test/cookie_jar.rb @@ -120,7 +120,7 @@ def initialize(cookies = [], default_host = DEFAULT_HOST) def [](name) cookies = hash_for(nil) # TODO: Should be case insensitive - cookies[name] && cookies[name].value + cookies[name.to_s] && cookies[name.to_s].value end def []=(name, value) diff --git a/spec/rack/test/cookie_spec.rb b/spec/rack/test/cookie_spec.rb index 7b1f69e3..ba69b0ac 100644 --- a/spec/rack/test/cookie_spec.rb +++ b/spec/rack/test/cookie_spec.rb @@ -43,6 +43,12 @@ expect(jar["abcd"]).to eq(nil) end + it "allow symbol access" do + jar = Rack::Test::CookieJar.new + jar["value"] = "foo;abc" + jar[:value].should == "foo;abc" + end + it "doesn't send cookies with the wrong domain" do get "http://www.example.com/cookies/set", "value" => "1" get "http://www.other.example/cookies/show"