Commit ff8e7e2d24ba4b1e80ce00963616b3ceca7e8441
1 parent
da6c280a
Exists in
master
and in
29 other branches
Use the appropriate API for deleting a cookie
Showing
2 changed files
with
2 additions
and
7 deletions
Show diff stats
plugins/shopping_cart/controllers/shopping_cart_plugin_controller.rb
... | ... | @@ -280,11 +280,7 @@ class ShoppingCartPluginController < PublicController |
280 | 280 | after_filter :save_cookie |
281 | 281 | def save_cookie |
282 | 282 | if @cart.nil? |
283 | - cookies[cookie_key] = { | |
284 | - :value => '', | |
285 | - :path => '/plugin/shopping_cart', | |
286 | - :expires => 1.year.ago, | |
287 | - } | |
283 | + cookies.delete(cookie_key, :path => '/plugin/shopping_cart') | |
288 | 284 | else |
289 | 285 | cookies[cookie_key] = { |
290 | 286 | :value => Base64.encode64(@cart.to_yaml), | ... | ... |
plugins/shopping_cart/test/functional/shopping_cart_plugin_controller_test.rb
... | ... | @@ -18,8 +18,7 @@ class ShoppingCartPluginControllerTest < ActionController::TestCase |
18 | 18 | |
19 | 19 | should 'force cookie expiration with explicit path for an empty cart' do |
20 | 20 | get :get |
21 | - last_year = 1.year.ago.year | |
22 | - assert @response.headers['Set-Cookie'].any? { |c| c =~ /_noosfero_plugin_shopping_cart=; path=\/plugin\/shopping_cart; expires=.*-#{last_year}/} | |
21 | + assert @response.headers['Set-Cookie'].any? { |c| c =~ /_noosfero_plugin_shopping_cart=; path=\/plugin\/shopping_cart; expires=.*-1970/} | |
23 | 22 | end |
24 | 23 | |
25 | 24 | should 'add a new product to cart' do | ... | ... |