Skip to content
This repository
Browse code

Allow AR Session Store to be renewed

  • Loading branch information...
commit 9c9f416d398c47dd2297fa5cc4025e0800d32212 1 parent 2651a87
José Valim authored November 11, 2010
20  actionpack/test/activerecord/active_record_store_test.rb
@@ -27,6 +27,12 @@ def call_reset_session
27 27
       head :ok
28 28
     end
29 29
 
  30
+    def renew
  31
+      env["rack.session.options"][:renew] = true
  32
+      session[:foo] = "baz"
  33
+      head :ok
  34
+    end
  35
+
30 36
     def rescue_action(e) raise end
31 37
   end
32 38
 
@@ -64,6 +70,20 @@ def teardown
64 70
         end
65 71
       end
66 72
     end
  73
+
  74
+    define_method("test_renewing_with_#{class_name}_store") do
  75
+      with_store class_name do
  76
+        with_test_route_set do
  77
+          get '/set_session_value'
  78
+          assert_response :success
  79
+          assert cookies['_session_id']
  80
+
  81
+          get '/renew'
  82
+          assert_response :success
  83
+          assert_not_equal [], headers['Set-Cookie']
  84
+        end
  85
+      end
  86
+    end
67 87
   end
68 88
 
69 89
   def test_getting_nil_session_value
1  activerecord/lib/active_record/session_store.rb
@@ -321,6 +321,7 @@ def destroy_session(env, session_id, options)
321 321
         if sid = current_session_id(env)
322 322
           Base.silence do
323 323
             get_session_model(env, sid).destroy
  324
+            env[SESSION_RECORD_KEY] = nil
324 325
           end
325 326
         end
326 327
 

0 notes on commit 9c9f416

Please sign in to comment.
Something went wrong with that request. Please try again.