Add a spec for User#requires_ldap_check?
This commit is contained in:
parent
82dc40936a
commit
1118a6fd34
|
@ -312,6 +312,29 @@ describe User do
|
|||
end
|
||||
end
|
||||
|
||||
describe :requires_ldap_check? do
|
||||
let(:user) { User.new }
|
||||
|
||||
it 'is false for non-LDAP users' do
|
||||
user.stub(ldap_user?: false)
|
||||
expect(user.requires_ldap_check?).to be_false
|
||||
end
|
||||
|
||||
context 'when the user is an LDAP user' do
|
||||
before { user.stub(ldap_user?: true) }
|
||||
|
||||
it 'is true when the user has never had an LDAP check before' do
|
||||
user.last_credential_check_at = nil
|
||||
expect(user.requires_ldap_check?).to be_true
|
||||
end
|
||||
|
||||
it 'is true when the last LDAP check happened over 1 hour ago' do
|
||||
user.last_credential_check_at = 2.hours.ago
|
||||
expect(user.requires_ldap_check?).to be_true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#full_website_url' do
|
||||
let(:user) { create(:user) }
|
||||
|
||||
|
|
Loading…
Reference in New Issue