diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2016-05-04 22:36:54 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2016-05-04 22:36:54 +0200 |
commit | 3bed679670dd8348ffc348509a653677c6ecb7f3 (patch) | |
tree | 9e5cd47acac9439ebb9b2825d3196e407b80a368 /actionpack/test | |
parent | 8352c8c6ef58eef822947faf8defc378e5de057c (diff) | |
parent | 09159d8530069ded68d1d5455dbe5009fb44c1c7 (diff) | |
download | rails-3bed679670dd8348ffc348509a653677c6ecb7f3.tar.gz rails-3bed679670dd8348ffc348509a653677c6ecb7f3.tar.bz2 rails-3bed679670dd8348ffc348509a653677c6ecb7f3.zip |
Merge pull request #24820 from maclover7/fix-15843
Ensure compatibility between ActionDispatch::Request::Session and Rack
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/dispatch/request/session_test.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/request/session_test.rb b/actionpack/test/dispatch/request/session_test.rb index 7dcbcc5c21..e022e7e21e 100644 --- a/actionpack/test/dispatch/request/session_test.rb +++ b/actionpack/test/dispatch/request/session_test.rb @@ -114,5 +114,31 @@ module ActionDispatch }.new end end + + class SessionIntegrationTest < ActionDispatch::IntegrationTest + class MySessionApp + def call(env) + request = Rack::Request.new(env) + request.session['hello'] = 'Hello from MySessionApp!' + [ 200, {}, ['Hello from MySessionApp!'] ] + end + end + + Router = ActionDispatch::Routing::RouteSet.new + Router.draw do + get '/mysessionapp' => MySessionApp.new + end + + def app + @app ||= RoutedRackApp.new(Router) + end + + def test_session_follows_rack_api_contract_1 + get '/mysessionapp' + assert_response :ok + assert_equal 'Hello from MySessionApp!', @response.body + assert_equal 'Hello from MySessionApp!', session['hello'] + end + end end end |