{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/23093","repository_url":"https://api.github.com/repos/rails/rails","labels_url":"https://api.github.com/repos/rails/rails/issues/23093/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/23093/comments","events_url":"https://api.github.com/repos/rails/rails/issues/23093/events","html_url":"https://github.com/rails/rails/pull/23093","id":127129957,"number":23093,"title":"Fix `ActionDispatch::IntegrationTest#open_session`","user":{"login":"tawan","id":6555,"avatar_url":"https://avatars.githubusercontent.com/u/6555?v=3","gravatar_id":"","url":"https://api.github.com/users/tawan","html_url":"https://github.com/tawan","followers_url":"https://api.github.com/users/tawan/followers","following_url":"https://api.github.com/users/tawan/following{/other_user}","gists_url":"https://api.github.com/users/tawan/gists{/gist_id}","starred_url":"https://api.github.com/users/tawan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tawan/subscriptions","organizations_url":"https://api.github.com/users/tawan/orgs","repos_url":"https://api.github.com/users/tawan/repos","events_url":"https://api.github.com/users/tawan/events{/privacy}","received_events_url":"https://api.github.com/users/tawan/received_events","type":"User","site_admin":false},"labels":[{"id":107189,"url":"https://api.github.com/repos/rails/rails/labels/actionpack","name":"actionpack","color":"FFF700","default":false},{"id":377277835,"url":"https://api.github.com/repos/rails/rails/labels/needs%20backport","name":"needs backport","color":"f9d0c4","default":false},{"id":257468118,"url":"https://api.github.com/repos/rails/rails/labels/needs%20work","name":"needs work","color":"000000","default":false}],"state":"open","locked":false,"assignee":{"login":"kaspth","id":350807,"avatar_url":"https://avatars.githubusercontent.com/u/350807?v=3","gravatar_id":"","url":"https://api.github.com/users/kaspth","html_url":"https://github.com/kaspth","followers_url":"https://api.github.com/users/kaspth/followers","following_url":"https://api.github.com/users/kaspth/following{/other_user}","gists_url":"https://api.github.com/users/kaspth/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspth/subscriptions","organizations_url":"https://api.github.com/users/kaspth/orgs","repos_url":"https://api.github.com/users/kaspth/repos","events_url":"https://api.github.com/users/kaspth/events{/privacy}","received_events_url":"https://api.github.com/users/kaspth/received_events","type":"User","site_admin":false},"assignees":[{"login":"kaspth","id":350807,"avatar_url":"https://avatars.githubusercontent.com/u/350807?v=3","gravatar_id":"","url":"https://api.github.com/users/kaspth","html_url":"https://github.com/kaspth","followers_url":"https://api.github.com/users/kaspth/followers","following_url":"https://api.github.com/users/kaspth/following{/other_user}","gists_url":"https://api.github.com/users/kaspth/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspth/subscriptions","organizations_url":"https://api.github.com/users/kaspth/orgs","repos_url":"https://api.github.com/users/kaspth/repos","events_url":"https://api.github.com/users/kaspth/events{/privacy}","received_events_url":"https://api.github.com/users/kaspth/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/rails/rails/milestones/53","html_url":"https://github.com/rails/rails/milestones/5.0.1","labels_url":"https://api.github.com/repos/rails/rails/milestones/53/labels","id":1730927,"number":53,"title":"5.0.1","description":null,"creator":{"login":"jeremy","id":199,"avatar_url":"https://avatars.githubusercontent.com/u/199?v=3","gravatar_id":"","url":"https://api.github.com/users/jeremy","html_url":"https://github.com/jeremy","followers_url":"https://api.github.com/users/jeremy/followers","following_url":"https://api.github.com/users/jeremy/following{/other_user}","gists_url":"https://api.github.com/users/jeremy/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremy/subscriptions","organizations_url":"https://api.github.com/users/jeremy/orgs","repos_url":"https://api.github.com/users/jeremy/repos","events_url":"https://api.github.com/users/jeremy/events{/privacy}","received_events_url":"https://api.github.com/users/jeremy/received_events","type":"User","site_admin":false},"open_issues":15,"closed_issues":41,"state":"open","created_at":"2016-04-26T02:02:53Z","updated_at":"2016-11-15T22:14:43Z","due_on":null,"closed_at":null},"comments":7,"created_at":"2016-01-17T22:46:34Z","updated_at":"2016-11-18T15:44:59Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/23093","html_url":"https://github.com/rails/rails/pull/23093","diff_url":"https://github.com/rails/rails/pull/23093.diff","patch_url":"https://github.com/rails/rails/pull/23093.patch"},"body":"Reset a new session directly after its creation in\n`ActionDispatch::IntegrationTest#open_session`. Reset the session to a clean\nstate before making it available to the client's test code.\n\nIssue #22742 reports unexpected behavior of integration tests that run multiple\nsessions. For example an `ActionDispatch::Flash` instance is shared across\nmultiple sessions, though a client code will rightfully assume that each new\nsession has its own flash hash.\n\nThe following test failed due to this behavior:\n\n```\nclass Issue22742Test < ActionDispatch::IntegrationTest\n  test 'issue #22742' do\n    integration_session # initialize first session\n    a = open_session\n    b = open_session\n\n    refute_same(a.integration_session, b.integration_session)\n  end\nend\n```\n\nInstead of creating a new `ActionDispatch::Integration::Session` instance,\nthe same instance is shared across all newly opened test sessions. This is\ndue to the way how new test sessions are created in\n`ActionDispatch::IntegrationTest#open_session`. The already existing\n`ActionDispatch::IntegrationTest` instance is duplicated  with `Object#dup`,\nThis approach was introduced in commit 15c31c7639b. `Object#dup` copies the\ninstance variables, but not the objects they reference. Therefore this issue\nonly occurred when the current test instance had been tapped in such a way that\nthe instance variable `@integration_session` was initialized before creating the\nnew test session.\n\nClose #22742\n"},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/261563578","html_url":"https://github.com/rails/rails/pull/23093#issuecomment-261563578","issue_url":"https://api.github.com/repos/rails/rails/issues/23093","id":261563578,"user":{"login":"sina-s","id":2576311,"avatar_url":"https://avatars.githubusercontent.com/u/2576311?v=3","gravatar_id":"","url":"https://api.github.com/users/sina-s","html_url":"https://github.com/sina-s","followers_url":"https://api.github.com/users/sina-s/followers","following_url":"https://api.github.com/users/sina-s/following{/other_user}","gists_url":"https://api.github.com/users/sina-s/gists{/gist_id}","starred_url":"https://api.github.com/users/sina-s/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sina-s/subscriptions","organizations_url":"https://api.github.com/users/sina-s/orgs","repos_url":"https://api.github.com/users/sina-s/repos","events_url":"https://api.github.com/users/sina-s/events{/privacy}","received_events_url":"https://api.github.com/users/sina-s/received_events","type":"User","site_admin":false},"created_at":"2016-11-18T15:44:59Z","updated_at":"2016-11-18T15:44:59Z","body":"I've added the test and updated the CHANGELOG (creditted to @tawan) in this branch: sina-s:fix-unexpected-session-sharing.\r\nI'm not sure what is the right way to merge it with this branch."}}
{"actor":{"display_login":"sina-s"}}