diff options
author | Guo Xiang Tan <tgx_world@hotmail.com> | 2014-06-12 20:48:21 -0700 |
---|---|---|
committer | Guo Xiang Tan <tgx_world@hotmail.com> | 2014-06-12 20:48:21 -0700 |
commit | be46586e691e28f3937666c3fff037eef22406de (patch) | |
tree | 68845f333de1da64d188713e4479702d18e4f063 /actionpack/lib/action_controller | |
parent | b4b3228566708ae67c2339e592e7698fcc2a398c (diff) | |
download | rails-be46586e691e28f3937666c3fff037eef22406de.tar.gz rails-be46586e691e28f3937666c3fff037eef22406de.tar.bz2 rails-be46586e691e28f3937666c3fff037eef22406de.zip |
Set flash in test session when necessary.
`to_session_value` returns nil when empty.
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/test_case.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index e6695ffc90..849286a4a9 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -629,8 +629,11 @@ module ActionController @response.prepare! @assigns = @controller.respond_to?(:view_assigns) ? @controller.view_assigns : {} - @request.session['flash'] = @request.flash.to_session_value - @request.session.delete('flash') if @request.session['flash'].blank? + + if flash_value = @request.flash.to_session_value + @request.session['flash'] = flash_value + end + @response end |