Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

get_me_the_cookie should return nil if the cookie doesn't exist.

I'm adding a test and a fix for rack-test.
  • Loading branch information...
commit cf482023c3c64e2f6c777c0a576d98897277fb6f 1 parent 026415c
@jordanstephens jordanstephens authored
View
3  lib/show_me_the_cookies/rack_test.rb
@@ -4,7 +4,8 @@ def initialize(rack_test_driver)
end
def get_me_the_cookie(cookie_name)
- _translate_cookie cookies.select {|c| c.name == cookie_name}.first
+ found = cookies.select {|c| c.name == cookie_name}
+ found.empty? ? nil : _translate_cookie(found.first)
end
def get_me_the_cookies
View
4 spec/shared_examples_for_api.rb
@@ -21,6 +21,10 @@ def cookies_should_not_contain(key, value)
end
end
+ it "returns nil for cookies that do not exist" do
+ get_me_the_cookie('some_unset_cookie').should be_nil
+ end
+
describe "get_me_the_cookies" do
it "returns an array of standardised cookie hashes" do
visit '/set/foo/bar'
Please sign in to comment.
Something went wrong with that request. Please try again.