mongo_session_store-rails 7.0.1 → 7.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -0
- data/lib/mongo_session_store/mongo_store_base.rb +1 -5
- data/lib/mongo_session_store/version.rb +1 -1
- data/mongo_session_store.gemspec +1 -1
- data/spec/lib/mongo_session_store/mongo_store/session_spec.rb +10 -10
- data/spec/lib/mongo_session_store/mongo_store_base_spec.rb +3 -3
- data/spec/spec_helper.rb +2 -0
- data/spec/support/helpers/session_id_helper.rb +5 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b2c427330f188c495b3fd4aa16d8352c3b71bf4
|
4
|
+
data.tar.gz: a22b000c5c5f2cd995d6b87ffc55b235c6fb2983
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12dc944b536e31d022d5247f56ce92428fef334c8316cbce37d0a770918cc06ef83c5240bbfcdbb081dd2ab49ad0df0535d44e8b69a405705dec526c99dc1292
|
7
|
+
data.tar.gz: 37fe63ee0f750b8bc1dec37ef0d03607947b4a5341069956ccbba2ce861cfdadc2e3e218b0b7627218f1fff2e43e19d03156b76cc3871d48eb4267c8047921d0
|
data/README.md
CHANGED
@@ -103,6 +103,25 @@ BUNDLE_GEMFILE=gemfiles/rails-4.2-mongo.gemfile bundle exec rake
|
|
103
103
|
BUNDLE_GEMFILE=gemfiles/rails-4.2-mongoid.gemfile bundle exec rake
|
104
104
|
```
|
105
105
|
|
106
|
+
## Performance benchmark
|
107
|
+
|
108
|
+
The repository includes a performance benchmark. It runrs against all available
|
109
|
+
included stores and outputs the results.
|
110
|
+
|
111
|
+
```
|
112
|
+
ruby perf/benchmark.rb
|
113
|
+
```
|
114
|
+
|
115
|
+
## Releases
|
116
|
+
|
117
|
+
To create a new release checkou the `master` branch and make sure it's in the
|
118
|
+
right state to release. Run the `release` Rake task and follow the
|
119
|
+
instructions.
|
120
|
+
|
121
|
+
```
|
122
|
+
rake release
|
123
|
+
```
|
124
|
+
|
106
125
|
## Previous contributors
|
107
126
|
|
108
127
|
MongoSessionStore started as a fork of the DataMapper session store, modified
|
@@ -16,10 +16,6 @@ module ActionDispatch
|
|
16
16
|
self.class.session_class
|
17
17
|
end
|
18
18
|
|
19
|
-
def generate_sid
|
20
|
-
BSON::ObjectId.new.to_s
|
21
|
-
end
|
22
|
-
|
23
19
|
def get_session(env, sid)
|
24
20
|
id, record = find_or_initialize_session(sid)
|
25
21
|
env[SESSION_RECORD_KEY] = record
|
@@ -40,7 +36,7 @@ module ActionDispatch
|
|
40
36
|
existing_session = (id && session_class.where(:_id => id).first)
|
41
37
|
session = existing_session if existing_session
|
42
38
|
session ||= session_class.new(:_id => generate_sid)
|
43
|
-
[session._id
|
39
|
+
[session._id, session]
|
44
40
|
end
|
45
41
|
|
46
42
|
def get_session_record(env, sid)
|
data/mongo_session_store.gemspec
CHANGED
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
|
|
5
5
|
s.version = MongoSessionStore::VERSION
|
6
6
|
|
7
7
|
s.authors = ["Tom de Bruijn", "Brian Hempel", "Nicolas M\303\251rouze", "Tony Pitale", "Chris Brickley"]
|
8
|
-
s.email = ["tom@tomdebruijn.com
|
8
|
+
s.email = ["tom@tomdebruijn.com"]
|
9
9
|
s.files = `git ls-files`.split("\n")
|
10
10
|
s.test_files = `git ls-files -- {spec,perf}/*`.split("\n")
|
11
11
|
s.homepage = "http://github.com/appsignal/mongo_session_store"
|
@@ -62,11 +62,11 @@ if mongo_orm == "mongo"
|
|
62
62
|
end
|
63
63
|
|
64
64
|
context "with matching records" do
|
65
|
-
let(:session) { described_class.new(:_id =>
|
65
|
+
let(:session) { described_class.new(:_id => generate_sid).tap(&:save) }
|
66
66
|
let(:id) { session._id }
|
67
67
|
before do
|
68
68
|
# Noise
|
69
|
-
described_class.new(:_id =>
|
69
|
+
described_class.new(:_id => generate_sid).tap(&:save)
|
70
70
|
end
|
71
71
|
|
72
72
|
it "returns session model objects" do
|
@@ -83,14 +83,14 @@ if mongo_orm == "mongo"
|
|
83
83
|
context "without data" do
|
84
84
|
let(:attributes) do
|
85
85
|
{
|
86
|
-
:_id =>
|
86
|
+
:_id => generate_sid,
|
87
87
|
:created_at => created_at,
|
88
88
|
:updated_at => updated_at
|
89
89
|
}
|
90
90
|
end
|
91
91
|
|
92
92
|
it "creates a session object with empty data" do
|
93
|
-
expect(session._id).to be_kind_of(
|
93
|
+
expect(session._id).to be_kind_of(String)
|
94
94
|
expect(session.data).to eq({})
|
95
95
|
expect(session.created_at).to eq(created_at)
|
96
96
|
expect(session.updated_at).to eq(updated_at)
|
@@ -100,7 +100,7 @@ if mongo_orm == "mongo"
|
|
100
100
|
context "with data key as a symbol" do
|
101
101
|
let(:attributes) do
|
102
102
|
{
|
103
|
-
:_id =>
|
103
|
+
:_id => generate_sid,
|
104
104
|
:data => BSON::Binary.new(Marshal.dump(:foo => "bar"), :generic),
|
105
105
|
:created_at => created_at,
|
106
106
|
:updated_at => updated_at
|
@@ -108,7 +108,7 @@ if mongo_orm == "mongo"
|
|
108
108
|
end
|
109
109
|
|
110
110
|
it "creates a session object with correct data" do
|
111
|
-
expect(session._id).to be_kind_of(
|
111
|
+
expect(session._id).to be_kind_of(String)
|
112
112
|
expect(session.data).to eq(:foo => "bar")
|
113
113
|
expect(session.created_at).to eq(created_at)
|
114
114
|
expect(session.updated_at).to eq(updated_at)
|
@@ -118,7 +118,7 @@ if mongo_orm == "mongo"
|
|
118
118
|
context "with data key as a string" do
|
119
119
|
let(:attributes) do
|
120
120
|
{
|
121
|
-
:_id =>
|
121
|
+
:_id => generate_sid,
|
122
122
|
"data" => BSON::Binary.new(Marshal.dump(:foo => "bar"), :generic),
|
123
123
|
:created_at => created_at,
|
124
124
|
:updated_at => updated_at
|
@@ -126,7 +126,7 @@ if mongo_orm == "mongo"
|
|
126
126
|
end
|
127
127
|
|
128
128
|
it "creates a session object with correct data" do
|
129
|
-
expect(session._id).to be_kind_of(
|
129
|
+
expect(session._id).to be_kind_of(String)
|
130
130
|
expect(session.data).to eq(:foo => "bar")
|
131
131
|
expect(session.created_at).to eq(created_at)
|
132
132
|
expect(session.updated_at).to eq(updated_at)
|
@@ -135,7 +135,7 @@ if mongo_orm == "mongo"
|
|
135
135
|
end
|
136
136
|
|
137
137
|
describe "#save" do
|
138
|
-
let(:id) {
|
138
|
+
let(:id) { generate_sid }
|
139
139
|
subject { described_class.collection.find(:_id => id).first }
|
140
140
|
|
141
141
|
describe "_id attribute" do
|
@@ -235,7 +235,7 @@ if mongo_orm == "mongo"
|
|
235
235
|
end
|
236
236
|
|
237
237
|
describe "#destroy" do
|
238
|
-
let(:id) {
|
238
|
+
let(:id) { generate_sid }
|
239
239
|
let(:session) { described_class.new(:_id => id) }
|
240
240
|
before { session.save }
|
241
241
|
|
@@ -99,10 +99,10 @@ describe ActionDispatch::Session::MongoStoreBase do
|
|
99
99
|
let(:store_class) { mongo_orm == "mongoid" ? MongoidStore : MongoStore }
|
100
100
|
let(:store) { store_class.new(nil) }
|
101
101
|
let(:session_class) { store_class::Session }
|
102
|
-
subject { store.send(:set_session, env,
|
102
|
+
subject { store.send(:set_session, env, generate_sid, {}) }
|
103
103
|
|
104
104
|
context "with existing session record" do
|
105
|
-
let(:id) {
|
105
|
+
let(:id) { generate_sid }
|
106
106
|
let!(:session_record) { session_class.new(:_id => id).tap(&:save) }
|
107
107
|
let(:env) do
|
108
108
|
{
|
@@ -182,7 +182,7 @@ describe ActionDispatch::Session::MongoStoreBase do
|
|
182
182
|
end
|
183
183
|
|
184
184
|
describe "#destroy_session" do
|
185
|
-
let(:id) {
|
185
|
+
let(:id) { generate_sid }
|
186
186
|
let(:store_class) { mongo_orm == "mongoid" ? MongoidStore : MongoStore }
|
187
187
|
let(:store) { store_class.new(nil) }
|
188
188
|
let(:session_class) { store_class::Session }
|
data/spec/spec_helper.rb
CHANGED
@@ -2,6 +2,7 @@ require "mongo"
|
|
2
2
|
require "mongoid" if Gem.loaded_specs["mongoid"]
|
3
3
|
require "mongo_session_store-rails"
|
4
4
|
require "support/helpers/test_database_helper"
|
5
|
+
require "support/helpers/session_id_helper"
|
5
6
|
|
6
7
|
def mongo_orm
|
7
8
|
defined?(Mongoid) ? "mongoid" : "mongo"
|
@@ -9,6 +10,7 @@ end
|
|
9
10
|
|
10
11
|
RSpec.configure do |config|
|
11
12
|
config.include TestDatabaseHelper
|
13
|
+
config.include SessionIdHelper
|
12
14
|
|
13
15
|
config.order = "random"
|
14
16
|
config.mock_with :rspec do |c|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongo_session_store-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0.
|
4
|
+
version: 7.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom de Bruijn
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2016-12-
|
15
|
+
date: 2016-12-05 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: actionpack
|
@@ -100,7 +100,7 @@ dependencies:
|
|
100
100
|
version: 0.45.0
|
101
101
|
description:
|
102
102
|
email:
|
103
|
-
- tom@tomdebruijn.com
|
103
|
+
- tom@tomdebruijn.com
|
104
104
|
executables: []
|
105
105
|
extensions: []
|
106
106
|
extra_rdoc_files: []
|
@@ -232,6 +232,7 @@ files:
|
|
232
232
|
- spec/support/apps/rails_4.2_app/db/migrate/20140301171212_add_devise_users.rb
|
233
233
|
- spec/support/apps/rails_4.2_app/db/schema.rb
|
234
234
|
- spec/support/apps/rails_4.2_app/db/seeds.rb
|
235
|
+
- spec/support/helpers/session_id_helper.rb
|
235
236
|
- spec/support/helpers/test_database_helper.rb
|
236
237
|
homepage: http://github.com/appsignal/mongo_session_store
|
237
238
|
licenses:
|
@@ -364,4 +365,5 @@ test_files:
|
|
364
365
|
- spec/support/apps/rails_4.2_app/db/migrate/20140301171212_add_devise_users.rb
|
365
366
|
- spec/support/apps/rails_4.2_app/db/schema.rb
|
366
367
|
- spec/support/apps/rails_4.2_app/db/seeds.rb
|
368
|
+
- spec/support/helpers/session_id_helper.rb
|
367
369
|
- spec/support/helpers/test_database_helper.rb
|