aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/components_test.rb
diff options
context:
space:
mode:
authorScott Barron <scott@elitists.net>2005-09-27 11:02:11 +0000
committerScott Barron <scott@elitists.net>2005-09-27 11:02:11 +0000
commita111e1a271917c56306b7935677ae212027f7702 (patch)
tree7ab97eddd3947c66e2aa5b555ae7d315f42e3078 /actionpack/test/controller/components_test.rb
parent72c3ffc7fb636859343b69fcf3c2bb418abe6883 (diff)
downloadrails-a111e1a271917c56306b7935677ae212027f7702.tar.gz
rails-a111e1a271917c56306b7935677ae212027f7702.tar.bz2
rails-a111e1a271917c56306b7935677ae212027f7702.zip
Keep flash after component is rendered. Closes #2291.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2363 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller/components_test.rb')
-rw-r--r--actionpack/test/controller/components_test.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/actionpack/test/controller/components_test.rb b/actionpack/test/controller/components_test.rb
index bf6f246702..b1aa80304c 100644
--- a/actionpack/test/controller/components_test.rb
+++ b/actionpack/test/controller/components_test.rb
@@ -25,6 +25,14 @@ class CallerController < ActionController::Base
render_text "Yes, ma'am"
end
+ def set_flash
+ render_component(:controller => 'callee', :action => 'set_flash')
+ end
+
+ def use_flash
+ render_component(:controller => 'callee', :action => 'use_flash')
+ end
+
def rescue_action(e) raise end
end
@@ -36,6 +44,15 @@ class CalleeController < ActionController::Base
def blowing_up
render_text "It's game over, man, just game over, man!", "500 Internal Server Error"
end
+
+ def set_flash
+ flash[:notice] = 'My stoney baby'
+ render :text => 'flash is set'
+ end
+
+ def use_flash
+ render :text => flash[:notice] || 'no flash'
+ end
def rescue_action(e) raise end
end
@@ -71,4 +88,13 @@ class ComponentsTest < Test::Unit::TestCase
get :internal_caller
assert_equal "Are you there? Yes, ma'am", @response.body
end
+
+ def test_flash
+ get :set_flash
+ assert_equal 'My stoney baby', flash[:notice]
+ get :use_flash
+ assert_equal 'My stoney baby', @response.body
+ get :use_flash
+ assert_equal 'no flash', @response.body
+ end
end \ No newline at end of file