diff options
author | eileencodes <eileencodes@gmail.com> | 2015-03-09 16:43:49 -0400 |
---|---|---|
committer | eileencodes <eileencodes@gmail.com> | 2015-03-09 17:11:15 -0400 |
commit | 2e4a01b92ca2165442c130071bd19af52d14d7cf (patch) | |
tree | b0e814b18ac0de0e259b602334a39fc4cb8d4b49 /actionpack/test/controller/integration_test.rb | |
parent | d5e55e960c2919ad71ea645d219677457e9832eb (diff) | |
download | rails-2e4a01b92ca2165442c130071bd19af52d14d7cf.tar.gz rails-2e4a01b92ca2165442c130071bd19af52d14d7cf.tar.bz2 rails-2e4a01b92ca2165442c130071bd19af52d14d7cf.zip |
Call super last in before_setup
This fixes the reasons 4cf3b8a, 303567e, and fa63448 needed to be
reverted in 7142059. The revert has been reverted and this fixes
the issues caused previously.
If we call `super` first we will end up nuking the session settings in the
application tests that do `setup do` - so any session login or cookie
settings will not be persisted thoughout the test sessions.
Calling `super` last prevents `@integration_session` from getting nuked
and set to nil if it's already set.
Test added to prevent regression of this behavior in the future.
Diffstat (limited to 'actionpack/test/controller/integration_test.rb')
-rw-r--r-- | actionpack/test/controller/integration_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb index 438c044da2..9504914dba 100644 --- a/actionpack/test/controller/integration_test.rb +++ b/actionpack/test/controller/integration_test.rb @@ -1036,3 +1036,15 @@ class IntegrationRequestsWithoutSetup < ActionDispatch::IntegrationTest end end end + +# to ensure that session requirements in setup are persisted in the tests +class IntegrationRequestsWithSessionSetup < ActionDispatch::IntegrationTest + setup do + cookies['user_name'] = 'david' + end + + def test_cookies_set_in_setup_are_persisted_through_the_session + get "/foo" + assert_equal({"user_name"=>"david"}, cookies.to_hash) + end +end |