aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2012-04-28 22:23:58 +0100
committerAndrew White <andyw@pixeltrix.co.uk>2012-04-28 22:36:16 +0100
commit5c18bdca321c9152ad2770a029636b9351e91666 (patch)
treea38ad4cbec7db1d678884e436626e3eb647ebe2a /actionpack/lib/action_controller
parente4c48fff379bef7492fc5158181395763ed843d1 (diff)
downloadrails-5c18bdca321c9152ad2770a029636b9351e91666.tar.gz
rails-5c18bdca321c9152ad2770a029636b9351e91666.tar.bz2
rails-5c18bdca321c9152ad2770a029636b9351e91666.zip
Merge session arg with existing session instead of overwriting
This may break existing tests that are asserting the whole session contents but should not break existing tests that are asserting individual keys - e.g: class SomeControllerTest < ActionController::TestCase setup do session['user_id'] = 1 end test "some test" do get :some_action, nil, { 'another_var' => 2 } # This assertion will now fail assert_equal({ 'another_var' => 2 }, session) # This assertion will still pass assert_equal 2, session['another_var] end end Fixes #1529.
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/test_case.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index 66a4808e36..7db7d270e5 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -471,7 +471,7 @@ module ActionController
@request.assign_parameters(@routes, controller_class_name, action.to_s, parameters)
- @request.session = ActionController::TestSession.new(session) if session
+ @request.session.update(session) if session
@request.session["flash"] = @request.flash.update(flash || {})
@request.session["flash"].sweep