summaryrefslogtreecommitdiff
path: root/test/spec_session_cookie.rb
diff options
context:
space:
mode:
authorJamie Macey <jamie@tracefunc.com>2012-07-19 12:46:50 -0700
committerJamie Macey <jamie@tracefunc.com>2012-07-19 12:46:50 -0700
commit630c4c3ee8da2692e90d8a74e5c9019acf0f5c9e (patch)
treee4f3eb00784b4d96f1d1d3f5dd6692b70fa00888 /test/spec_session_cookie.rb
parente4172e79b5b68e6bdd2ba45e3e590398fb456308 (diff)
downloadrack-630c4c3ee8da2692e90d8a74e5c9019acf0f5c9e.tar.gz
load session data for merge!
ID#prepare_session calls merge! on the newly-created SessionHash, but this method is not overridden to parse existing data. As such, any previous session data passed in from an earlier middleware is discarded. For me, this was breaking Rack::Test while testing a Sinatra app.
Diffstat (limited to 'test/spec_session_cookie.rb')
-rw-r--r--test/spec_session_cookie.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/spec_session_cookie.rb b/test/spec_session_cookie.rb
index 66490b53..e325584d 100644
--- a/test/spec_session_cookie.rb
+++ b/test/spec_session_cookie.rb
@@ -338,4 +338,11 @@ describe Rack::Session::Cookie do
response = response_for(:app => session_id, :request => request)
response.body.should.match(/foo/)
end
+
+ it "allows modifying session data with session data from middleware in front" do
+ request = { 'rack.session' => { :foo => 'bar' }}
+ response = response_for(:app => incrementor, :request => request)
+ response.body.should.match(/counter/)
+ response.body.should.match(/foo/)
+ end
end