Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fisting Session::AbstractStore#clear to actually clear the session. [#…

…5030 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information...
commit 67e18c523cbe55e21742ec631b90218f46c45513 1 parent 526f1e5
@tenderlove tenderlove authored jeremy committed
View
5 actionpack/lib/action_controller/session/abstract_store.rb
@@ -34,6 +34,11 @@ def []=(key, value)
super
end
+ def clear
+ load! unless @loaded
+ super
+ end
+
def to_hash
h = {}.replace(self)
h.delete_if { |k,v| v.nil? }
View
22 actionpack/test/controller/session/cookie_store_test.rb
@@ -34,6 +34,11 @@ def get_session_id
render :text => "foo: #{session[:foo].inspect}; id: #{request.session_options[:id]}"
end
+ def call_session_clear
+ session.clear
+ head :ok
+ end
+
def call_reset_session
reset_session
head :ok
@@ -184,6 +189,23 @@ def test_setting_session_value_after_session_reset
end
end
+ def test_setting_session_value_after_session_clear
+ with_test_route_set do
+ get '/set_session_value'
+ assert_response :success
+ session_payload = response.body
+ assert_equal ["_myapp_session=#{response.body}; path=/; HttpOnly"],
+ headers['Set-Cookie']
+
+ get '/call_session_clear'
+ assert_response :success
+
+ get '/get_session_value'
+ assert_response :success
+ assert_equal 'foo: nil', response.body
+ end
+ end
+
def test_persistent_session_id
with_test_route_set do
cookies[SessionKey] = SignedBar
Please sign in to comment.
Something went wrong with that request. Please try again.