diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-05-22 00:49:06 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-06-22 13:13:46 +0300 |
commit | 5a9ede472150ec78f8410ae15cf782095c8f056c (patch) | |
tree | 5cbdbfb971329960011e8b3a3544e583f9551f6c /spec/models/user_spec.rb | |
parent | dad88568f34bfda5f7fe34672bc5099c80226138 (diff) |
Update mock and stub syntax for specs
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r-- | spec/models/user_spec.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index afdd9f71af2..9f7c83f3476 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -458,21 +458,25 @@ describe User do it 'is false when LDAP is disabled' do # Create a condition which would otherwise cause 'true' to be returned - user.stub(ldap_user?: true) + allow(user).to receive(:ldap_user?).and_return(true) user.last_credential_check_at = nil expect(user.requires_ldap_check?).to be_falsey end context 'when LDAP is enabled' do - before { Gitlab.config.ldap.stub(enabled: true) } + before do + allow(Gitlab.config.ldap).to receive(:enabled).and_return(true) + end it 'is false for non-LDAP users' do - user.stub(ldap_user?: false) + allow(user).to receive(:ldap_user?).and_return(false) expect(user.requires_ldap_check?).to be_falsey end context 'and when the user is an LDAP user' do - before { user.stub(ldap_user?: true) } + before do + allow(user).to receive(:ldap_user?).and_return(true) + end it 'is true when the user has never had an LDAP check before' do user.last_credential_check_at = nil |