Skip to content

Commit

Permalink
Add more cookie tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fxposter committed Nov 22, 2012
1 parent fa46aa1 commit 52a4346
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions actionpack/test/dispatch/cookies_test.rb
Expand Up @@ -109,6 +109,12 @@ def clear_encrypted_cookie
head :ok head :ok
end end


def delete_and_set_signed_permanent_encrypted_cookie
cookies.signed.permanent.encrypted.delete :user_name
cookies.signed.permanent.encrypted[:user_surname] = 'Smith'
head :ok
end

def set_cookie_with_domain def set_cookie_with_domain
cookies[:user_name] = {:value => "rizwanreza", :domain => :all} cookies[:user_name] = {:value => "rizwanreza", :domain => :all}
head :ok head :ok
Expand Down Expand Up @@ -370,6 +376,14 @@ def test_clear_encrypted_cookie
assert @controller.send(:cookies).encrypted.deleted?(:user_name) assert @controller.send(:cookies).encrypted.deleted?(:user_name)
end end


def test_delete_and_set_signed_permanent_encrypted_cookie
@controller.send(:cookies).signed.permanent.encrypted[:user_name] = 'Joe'
get :delete_and_set_signed_permanent_encrypted_cookie
assert_nil @controller.send(:cookies)[:user_name]
assert_nil @controller.send(:cookies).signed.permanent.encrypted[:user_name]
assert_equal @controller.send(:cookies).signed.permanent.encrypted[:user_surname], 'Smith'
end

def test_delete_and_set_cookie def test_delete_and_set_cookie
request.cookies[:user_name] = 'Joe' request.cookies[:user_name] = 'Joe'
get :delete_and_set_cookie get :delete_and_set_cookie
Expand Down

0 comments on commit 52a4346

Please sign in to comment.