mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
064744bef6
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
|
||
---|---|---|
.. | ||
api | ||
controller_fixtures | ||
metal | ||
mime | ||
new_base | ||
parameters | ||
request | ||
action_pack_assertions_test.rb | ||
base_test.rb | ||
caching_test.rb | ||
content_type_test.rb | ||
default_url_options_with_before_action_test.rb | ||
filters_test.rb | ||
flash_hash_test.rb | ||
flash_test.rb | ||
force_ssl_test.rb | ||
form_builder_test.rb | ||
helper_test.rb | ||
http_basic_authentication_test.rb | ||
http_digest_authentication_test.rb | ||
http_token_authentication_test.rb | ||
integration_test.rb | ||
live_stream_test.rb | ||
localized_templates_test.rb | ||
log_subscriber_test.rb | ||
output_escaping_test.rb | ||
parameter_encoding_test.rb | ||
params_wrapper_test.rb | ||
permitted_params_test.rb | ||
redirect_test.rb | ||
render_js_test.rb | ||
render_json_test.rb | ||
render_test.rb | ||
render_xml_test.rb | ||
renderer_test.rb | ||
renderers_test.rb | ||
request_forgery_protection_test.rb | ||
required_params_test.rb | ||
rescue_test.rb | ||
resources_test.rb | ||
routing_test.rb | ||
runner_test.rb | ||
send_file_test.rb | ||
show_exceptions_test.rb | ||
streaming_test.rb | ||
test_case_test.rb | ||
url_for_integration_test.rb | ||
url_for_test.rb | ||
url_rewriter_test.rb | ||
webservice_test.rb |