move token validity to trusted_device_token
This commit is contained in:
parent
b9b83cca3a
commit
23db8a160c
5 changed files with 26 additions and 29 deletions
15
spec/models/trusted_device_token_spec.rb
Normal file
15
spec/models/trusted_device_token_spec.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
RSpec.describe TrustedDeviceToken, type: :model do
|
||||
describe '#token_valid?' do
|
||||
let(:token) { TrustedDeviceToken.create }
|
||||
|
||||
context 'when the token is create after login_token_validity' do
|
||||
it { expect(token.token_valid?).to be true }
|
||||
end
|
||||
|
||||
context 'when the token is create before login_token_validity' do
|
||||
before { token.update(created_at: (TrustedDeviceToken::LOGIN_TOKEN_VALIDITY + 1.minute).ago) }
|
||||
|
||||
it { expect(token.token_valid?).to be false }
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue