signinable 2.0.15 → 2.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/signinable/model_additions.rb +11 -7
- 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 +2 -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.16
|
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-06-
|
11
|
+
date: 2022-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|