aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/ordered_options_test.rb
diff options
context:
space:
mode:
authorTawan Sierek <tawan.sierek@gmail.com>2016-01-17 21:41:45 +0100
committerRafael Mendonça França <rafaelmfranca@gmail.com>2016-11-18 15:07:16 -0500
commit064744bef6175d382d508846c790658d46e311c4 (patch)
treebdc9ca9d376859dffe336ccadf69f190228625ef /activesupport/test/ordered_options_test.rb
parent8dbc1ca339e63e00c8da0f0e74cd38ce507415b1 (diff)
downloadrails-064744bef6175d382d508846c790658d46e311c4.tar.gz
rails-064744bef6175d382d508846c790658d46e311c4.tar.bz2
rails-064744bef6175d382d508846c790658d46e311c4.zip
Fix `ActionDispatch::IntegrationTest#open_session`
Reset a new session directly after its creation in `ActionDispatch::IntegrationTest#open_session`. Reset the session to a clean state before making it available to the client's test code. Issue #22742 reports unexpected behavior of integration tests that run multiple sessions. For example an `ActionDispatch::Flash` instance is shared across multiple sessions, though a client code will rightfully assume that each new session has its own flash hash. The following test failed due to this behavior: class Issue22742Test < ActionDispatch::IntegrationTest test 'issue #22742' do integration_session # initialize first session a = open_session b = open_session refute_same(a.integration_session, b.integration_session) end end Instead of creating a new `ActionDispatch::Integration::Session` instance, the same instance is shared across all newly opened test sessions. This is due to the way how new test sessions are created in `ActionDispatch::IntegrationTest#open_session`. The already existing `ActionDispatch::IntegrationTest` instance is duplicated with `Object#dup`, This approach was introduced in commit 15c31c7639b. `Object#dup` copies the instance variables, but not the objects they reference. Therefore this issue only occurred when the current test instance had been tapped in such a way that the instance variable `@integration_session` was initialized before creating the new test session. Close #22742 [Tawan Sierek + Sina Sadeghian]
Diffstat (limited to 'activesupport/test/ordered_options_test.rb')
0 files changed, 0 insertions, 0 deletions