Permalink
Browse files

Provide failing test case for #3298 #2509

  • Loading branch information...
1 parent f23f5ec commit 86a5271e744f8a699a8307d447c93c16d82bf5c2 @josevalim josevalim committed Oct 12, 2011
Showing with 30 additions and 0 deletions.
  1. +30 −0 actionpack/test/dispatch/session/cookie_store_test.rb
@@ -55,6 +55,16 @@ def renew_session_id
head :ok
end
+ def set_flash_like
+ session[:flash_like] = ActionDispatch::Flash::FlashHash.new
+ session[:flash_like]["foo"] = "bar"
+ head :ok
+ end
+
+ def read_flash_like
+ render :text => session[:flash_like].inspect
+ end
+
def rescue_action(e) raise end
end
@@ -90,6 +100,26 @@ def test_getting_session_id
end
end
+ def test_disregards_outdated_flash_class
+ with_test_route_set do
+ correct = ActionDispatch::Flash::FlashHash
+ wrong = Class.new(Hash)
+
+ ActionDispatch::Flash.send :remove_const, :FlashHash
+ ActionDispatch::Flash.send :const_set, :FlashHash, wrong
+
+ get '/set_flash_like'
+ assert_response :success
+
+ ActionDispatch::Flash.send :remove_const, :FlashHash
+ ActionDispatch::Flash.send :const_set, :FlashHash, correct
+
+ get '/read_flash_like'
+ assert_response :success
+ assert_equal 'nil', response.body
+ end
+ end
+
def test_disregards_tampered_sessions
with_test_route_set do
cookies[SessionKey] = "BAh7BjoIZm9vIghiYXI%3D--123456780"

0 comments on commit 86a5271

Please sign in to comment.