signinable 2.0.14 → 2.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/db/migrate/20220814152804_change_signinable_id_to_string.rb +12 -0
- data/lib/signinable/model_additions.rb +12 -8
- data/lib/signinable/version.rb +1 -1
- data/spec/dummy/log/test.log +2350 -0
- data/spec/models/user_spec.rb +11 -5
- data/spec/support/utilities.rb +2 -2
- metadata +3 -2
data/spec/models/user_spec.rb
CHANGED
@@ -77,10 +77,18 @@ describe User do
|
|
77
77
|
end
|
78
78
|
|
79
79
|
describe '#signout' do
|
80
|
+
it 'ignores expired signin' do
|
81
|
+
sign_in_user(user, credentials)
|
82
|
+
signin = user.last_signin
|
83
|
+
Timecop.travel(signin.expiration_time) do
|
84
|
+
expect(sign_out_user(user, credentials)).to be_falsey
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
80
88
|
it 'should expire signin' do
|
81
89
|
sign_in_user(user, credentials)
|
82
90
|
signin = user.last_signin
|
83
|
-
sign_out_user(
|
91
|
+
sign_out_user(user, credentials)
|
84
92
|
expect(signin.reload).to be_expired
|
85
93
|
end
|
86
94
|
|
@@ -88,8 +96,7 @@ describe User do
|
|
88
96
|
%i[ip user_agent].each do |c|
|
89
97
|
it "allows signout when #{c} changes" do
|
90
98
|
sign_in_user(user, credentials)
|
91
|
-
|
92
|
-
expect(sign_out_user(signin, credentials)).to be_truthy
|
99
|
+
expect(sign_out_user(user, credentials)).to be_truthy
|
93
100
|
end
|
94
101
|
end
|
95
102
|
end
|
@@ -99,8 +106,7 @@ describe User do
|
|
99
106
|
it "forbids signout when #{c} changes" do
|
100
107
|
allow(described_class).to receive(:signin_restrictions).and_return([c])
|
101
108
|
sign_in_user(user, credentials)
|
102
|
-
|
103
|
-
expect(sign_out_user(signin, other_credentials)).to be_nil
|
109
|
+
expect(sign_out_user(user, other_credentials)).to be_nil
|
104
110
|
end
|
105
111
|
end
|
106
112
|
end
|
data/spec/support/utilities.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: signinable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Novozhenets
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|
@@ -122,6 +122,7 @@ files:
|
|
122
122
|
- config/routes.rb
|
123
123
|
- db/migrate/20140103165607_create_signins.rb
|
124
124
|
- db/migrate/20180530131006_add_custom_data_to_sigins.rb
|
125
|
+
- db/migrate/20220814152804_change_signinable_id_to_string.rb
|
125
126
|
- lib/signinable.rb
|
126
127
|
- lib/signinable/engine.rb
|
127
128
|
- lib/signinable/model_additions.rb
|