diff options
author | Mikel Lindsaar <raasdnil@gmail.com> | 2010-01-17 12:46:51 +1100 |
---|---|---|
committer | Mikel Lindsaar <raasdnil@gmail.com> | 2010-01-17 12:46:51 +1100 |
commit | 6f663addaa7ed40f1133687d7a2be0958bf0c059 (patch) | |
tree | 7beb7f092c1979d1fd5ea6e7aaaf4f59c2f4abf4 /actionpack/test/controller/flash_test.rb | |
parent | 8834b2612b7ddda70ee6a685eb0063d3daa8e63d (diff) | |
parent | 3e94032227d450d479f511070c51f37f53d0ecc4 (diff) | |
download | rails-6f663addaa7ed40f1133687d7a2be0958bf0c059.tar.gz rails-6f663addaa7ed40f1133687d7a2be0958bf0c059.tar.bz2 rails-6f663addaa7ed40f1133687d7a2be0958bf0c059.zip |
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'actionpack/test/controller/flash_test.rb')
-rw-r--r-- | actionpack/test/controller/flash_test.rb | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/actionpack/test/controller/flash_test.rb b/actionpack/test/controller/flash_test.rb index a9b60386f1..85a2e7f44b 100644 --- a/actionpack/test/controller/flash_test.rb +++ b/actionpack/test/controller/flash_test.rb @@ -159,7 +159,7 @@ class FlashTest < ActionController::TestCase end def test_keep_and_discard_return_values - flash = ActionController::Flash::FlashHash.new + flash = ActionDispatch::Flash::FlashHash.new flash.update(:foo => :foo_indeed, :bar => :bar_indeed) assert_equal(:foo_indeed, flash.discard(:foo)) # valid key passed @@ -187,4 +187,42 @@ class FlashTest < ActionController::TestCase get :redirect_with_other_flashes assert_equal "Horses!", @controller.send(:flash)[:joyride] end -end
\ No newline at end of file +end + +class FlashIntegrationTest < ActionController::IntegrationTest + SessionKey = '_myapp_session' + SessionSecret = 'b3c631c314c0bbca50c1b2843150fe33' + + class TestController < ActionController::Base + def set_flash + flash["that"] = "hello" + head :ok + end + + def use_flash + render :inline => "flash: #{flash["that"]}" + end + end + + def test_flash + with_test_route_set do + get '/set_flash' + assert_response :success + assert_equal "hello", @request.flash["that"] + + get '/use_flash' + assert_response :success + assert_equal "flash: hello", @response.body + end + end + + private + def with_test_route_set + with_routing do |set| + set.draw do |map| + match ':action', :to => ActionDispatch::Session::CookieStore.new(TestController, :key => SessionKey, :secret => SessionSecret) + end + yield + end + end +end |