Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### 3.2.3 (Next)

* [#57](https://github.com/mongoid/mongo_session_store/pull/57): Cover legacy session decoding and version loading, and fix private decoder delegation in the plain-driver adapter - [@dblock](https://github.com/dblock).
* [#55](https://github.com/mongoid/mongo_session_store/pull/55): Add explicit bulk stale-session cleanup with an application-selected cutoff for both adapters - [@dblock](https://github.com/dblock).
* [#54](https://github.com/mongoid/mongo_session_store/pull/54): Document and test storing permitted parameter hashes rather than request-bearing Rails parameter objects in sessions - [@dblock](https://github.com/dblock).
* [#53](https://github.com/mongoid/mongo_session_store/pull/53): Cover Rails 6.1 through 8.0 in CI, update RuboCop, isolate Danger permissions, and report both adapters' coverage to Coveralls - [@dblock](https://github.com/dblock).
Expand Down
1 change: 1 addition & 0 deletions gemfiles/rails-current-mongo.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ gem "drb"
gem "base64"
gem "benchmark"
gem "ostruct"
gem "simplecov", "~> 0.22", :require => false if ENV["COVERAGE"] == "true"

gemspec :path => "../"
2 changes: 1 addition & 1 deletion lib/mongo_session_store/mongo_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def pack(data)
end

def unpack(packed)
self.class.unpack(packed)
self.class.send(:unpack, packed)
end
end
end
Expand Down
17 changes: 17 additions & 0 deletions spec/lib/mongo_session_store/legacy_serialization_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require "spec_helper"

describe "Legacy session serialization" do
let(:session_class) { mongo_orm == "mongoid" ? MongoidStore::Session : MongoStore::Session }

it "reads raw marshalled strings as well as BSON binary data" do
payload = { "nested" => { "count" => 2 }, "tags" => %w[old session] }
session = session_class.new

expect(session.send(:unpack, Marshal.dump(payload))).to eq(payload)
expect(session.send(:unpack, BSON::Binary.new(Marshal.dump(payload), :generic))).to eq(payload)
end

it "returns nil when there is no serialized payload" do
expect(session_class.new.send(:unpack, nil)).to be_nil
end
end
13 changes: 13 additions & 0 deletions spec/lib/mongo_session_store/version_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require "spec_helper"

describe "Version entry point" do
it "defines a frozen semantic version when loaded on its own" do
hide_const("MongoSessionStore::VERSION")
load File.expand_path("../../../lib/mongo_session_store/version.rb", __dir__)

expect(MongoSessionStore::VERSION).to match(/\A\d+\.\d+\.\d+\z/)
expect(MongoSessionStore::VERSION).to be_frozen
ensure
MongoSessionStore.send(:remove_const, :VERSION) if MongoSessionStore.const_defined?(:VERSION)
end
end
Loading