trustedDeviceToken: move token youth

This commit is contained in:
simon lehericey 2019-02-04 11:04:55 +01:00
parent 23db8a160c
commit d664f130fd
4 changed files with 22 additions and 6 deletions

View file

@ -12,4 +12,18 @@ RSpec.describe TrustedDeviceToken, type: :model do
it { expect(token.token_valid?).to be false }
end
end
describe '#token_young?' do
let(:token) { TrustedDeviceToken.create }
context 'when the token is create after login_token_youth' do
it { expect(token.token_young?).to be true }
end
context 'when the token is create before login_token_youth' do
before { token.update(created_at: (TrustedDeviceToken::LOGIN_TOKEN_YOUTH + 1.minute).ago) }
it { expect(token.token_young?).to be false }
end
end
end