Skip to content
Browse files

Add test to flash sweep after two redirects

This test is needed to avoid regressions in the way that flash works
now (swept in every request).
  • Loading branch information...
1 parent 6347554 commit f7cde3eb2231f31764739a9abdf2610dd2721fe8 @rafaelfranca rafaelfranca committed Jun 3, 2012
Showing with 20 additions and 0 deletions.
  1. +20 −0 actionpack/test/controller/flash_test.rb
View
20 actionpack/test/controller/flash_test.rb
@@ -231,6 +231,10 @@ def set_flash_now
def use_flash
render :inline => "flash: #{flash["that"]}"
end
+
+ def redirect_without_flash
+ redirect_to '/somewhere'
+ end
end
def test_flash
@@ -245,6 +249,22 @@ def test_flash
end
end
+ def test_redirect
+ with_test_route_set do
+ get '/set_flash'
+ assert_response :success
+ assert_equal "hello", @request.flash["that"]
+
+ get '/redirect_without_flash'
+ assert_response :redirect
+ assert_equal "hello", @request.flash["that"]
+
+ get '/redirect_without_flash'
+ assert_response :redirect
+ assert_equal nil, @request.flash["that"]
+ end
+ end
+
def test_just_using_flash_does_not_stream_a_cookie_back
with_test_route_set do
get '/use_flash'

0 comments on commit f7cde3e

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