signinable 2.0.14 → 2.0.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -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(signin, credentials)
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
- signin = user.last_signin
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
- signin = user.last_signin
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
@@ -4,6 +4,6 @@ def sign_in_user(user, credentials)
4
4
  user.signin(*credentials, 'referer')
5
5
  end
6
6
 
7
- def sign_out_user(signin, credentials)
8
- signin.signinable.signout(signin.token, *credentials)
7
+ def sign_out_user(user, credentials)
8
+ user.signout(user.jwt, *credentials)
9
9
  end
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.14
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-06-16 00:00:00.000000000 Z
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