Permalink
Browse files

Merge pull request #411 from jamie/master

Handle existing rack.session where the app modifies session vars
  • Loading branch information...
2 parents 7c36a88 + 630c4c3 commit 03b1d6f99241ad8b713f93cefc39ae881185e2e7 @raggi raggi committed Aug 26, 2012
Showing with 12 additions and 0 deletions.
  1. +5 −0 lib/rack/session/abstract/id.rb
  2. +7 −0 test/spec_session_cookie.rb
@@ -120,6 +120,11 @@ def empty?
super
end
+ def merge!(hash)
+ load_for_write!
+ super
+ end
+
private
def load_for_read!
@@ -338,4 +338,11 @@ def call(env)
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

0 comments on commit 03b1d6f

Please sign in to comment.