[fix #4361] administrateur active

This commit is contained in:
simon lehericey 2019-10-24 11:21:12 +02:00
parent 2a052ab1ac
commit 8ae592fe25
7 changed files with 29 additions and 34 deletions

View file

@ -50,4 +50,22 @@ describe Administrateur, type: :model do
# it { expect(subject).to eq([]) }
# end
# end
describe '#active?' do
let!(:administrateur) { create(:administrateur) }
subject { administrateur.active? }
context 'when the user has never signed in' do
before { administrateur.user.update(last_sign_in_at: nil) }
it { is_expected.to be false }
end
context 'when the user has already signed in' do
before { administrateur.user.update(last_sign_in_at: Time.zone.now) }
it { is_expected.to be true }
end
end
end