diff options
author | Jeffrey Hardy <packagethief@gmail.com> | 2009-10-14 00:26:53 -0400 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-10-14 11:50:51 -0700 |
commit | a8dc9fd27b845193fd209a249e084f993a10c19d (patch) | |
tree | bf82adb1476ae733e8a0b3a028229a6fb69cc127 /actionpack/test | |
parent | ff8be66f249d49e82c8e1d04cb8cfbbc128deabe (diff) | |
download | rails-a8dc9fd27b845193fd209a249e084f993a10c19d.tar.gz rails-a8dc9fd27b845193fd209a249e084f993a10c19d.tar.bz2 rails-a8dc9fd27b845193fd209a249e084f993a10c19d.zip |
CookieJar#delete should return the key's value, consistent with a Hash
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/cookie_test.rb | 7 | ||||
-rw-r--r-- | actionpack/test/dispatch/session/test_session_test.rb | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/actionpack/test/controller/cookie_test.rb b/actionpack/test/controller/cookie_test.rb index 7199da3441..b429cbf0e6 100644 --- a/actionpack/test/controller/cookie_test.rb +++ b/actionpack/test/controller/cookie_test.rb @@ -118,6 +118,13 @@ class CookieTest < ActionController::TestCase assert_equal %w{1 2 3}, jar["pages"] end + def test_cookiejar_delete_removes_item_and_returns_its_value + @request.cookies["user_name"] = "david" + @controller.response = @response + jar = ActionController::CookieJar.new(@controller) + assert_equal "david", jar.delete("user_name") + end + def test_delete_cookie_with_path get :delete_cookie_with_path assert_cookie_header "user_name=; path=/beaten; expires=Thu, 01-Jan-1970 00:00:00 GMT" diff --git a/actionpack/test/dispatch/session/test_session_test.rb b/actionpack/test/dispatch/session/test_session_test.rb index 0ff93f1c5d..c8dc4ab461 100644 --- a/actionpack/test/dispatch/session/test_session_test.rb +++ b/actionpack/test/dispatch/session/test_session_test.rb @@ -26,11 +26,11 @@ class ActionController::TestSessionTest < ActiveSupport::TestCase assert_equal('value', session[:key]) end - def test_calling_delete_removes_item + def test_calling_delete_removes_item_and_returns_its_value session = ActionController::TestSession.new session[:key] = 'value' assert_equal('value', session[:key]) - session.delete(:key) + assert_equal('value', session.delete(:key)) assert_nil(session[:key]) end |