aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/flash_test.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2009-12-17 16:37:11 -0800
committerDavid Heinemeier Hansson <david@loudthinking.com>2009-12-17 16:37:11 -0800
commitfa575973b1ad5adb7115a18c4c1c7c31500e73b2 (patch)
tree6fb71516dfd7e24758825093ad37337205669e26 /actionpack/test/controller/flash_test.rb
parent2bfa477128ef36e5664709684b51c20bebf1ee70 (diff)
downloadrails-fa575973b1ad5adb7115a18c4c1c7c31500e73b2.tar.gz
rails-fa575973b1ad5adb7115a18c4c1c7c31500e73b2.tar.bz2
rails-fa575973b1ad5adb7115a18c4c1c7c31500e73b2.zip
Added alert/notice from 2-3-stable and refactored redirect_to into just living in Redirector [DHH]
Diffstat (limited to 'actionpack/test/controller/flash_test.rb')
-rw-r--r--actionpack/test/controller/flash_test.rb29
1 files changed, 28 insertions, 1 deletions
diff --git a/actionpack/test/controller/flash_test.rb b/actionpack/test/controller/flash_test.rb
index c448f36cb3..1f5be431ac 100644
--- a/actionpack/test/controller/flash_test.rb
+++ b/actionpack/test/controller/flash_test.rb
@@ -72,6 +72,18 @@ class FlashTest < ActionController::TestCase
redirect_to :action => "std_action"
@flash_copy = {}.update(flash)
end
+
+ def redirect_with_alert
+ redirect_to '/nowhere', :alert => "Beware the nowheres!"
+ end
+
+ def redirect_with_notice
+ redirect_to '/somewhere', :notice => "Good luck in the somewheres!"
+ end
+
+ def redirect_with_other_flashes
+ redirect_to '/wonderland', :flash => { :joyride => "Horses!" }
+ end
end
tests TestController
@@ -160,4 +172,19 @@ class FlashTest < ActionController::TestCase
assert_equal({:foo => :foo_indeed, :bar => :bar_indeed}, flash.keep()) # nothing passed
assert_equal({:foo => :foo_indeed, :bar => :bar_indeed}, flash.keep(nil)) # nothing passed
end
-end
+
+ def test_redirect_to_with_alert
+ get :redirect_with_alert
+ assert_equal "Beware the nowheres!", @controller.send(:flash)[:alert]
+ end
+
+ def test_redirect_to_with_notice
+ get :redirect_with_notice
+ assert_equal "Good luck in the somewheres!", @controller.send(:flash)[:notice]
+ end
+
+ def test_redirect_to_with_other_flashes
+ get :redirect_with_other_flashes
+ assert_equal "Horses!", @controller.send(:flash)[:joyride]
+ end
+end \ No newline at end of file