diff options
Diffstat (limited to 'spec/lib/gitlab/ldap')
-rw-r--r-- | spec/lib/gitlab/ldap/access_spec.rb | 8 | ||||
-rw-r--r-- | spec/lib/gitlab/ldap/adapter_spec.rb | 6 | ||||
-rw-r--r-- | spec/lib/gitlab/ldap/authentication_spec.rb | 12 | ||||
-rw-r--r-- | spec/lib/gitlab/ldap/config_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/ldap/user_spec.rb | 6 |
5 files changed, 17 insertions, 17 deletions
diff --git a/spec/lib/gitlab/ldap/access_spec.rb b/spec/lib/gitlab/ldap/access_spec.rb index 4573b8696c4..a2b05249147 100644 --- a/spec/lib/gitlab/ldap/access_spec.rb +++ b/spec/lib/gitlab/ldap/access_spec.rb @@ -10,7 +10,7 @@ describe Gitlab::LDAP::Access do context 'when the user cannot be found' do before { Gitlab::LDAP::Person.stub(find_by_dn: nil) } - it { should be_false } + it { is_expected.to be_falsey } end context 'when the user is found' do @@ -19,13 +19,13 @@ describe Gitlab::LDAP::Access do context 'and the user is diabled via active directory' do before { Gitlab::LDAP::Person.stub(disabled_via_active_directory?: true) } - it { should be_false } + it { is_expected.to be_falsey } end context 'and has no disabled flag in active diretory' do before { Gitlab::LDAP::Person.stub(disabled_via_active_directory?: false) } - it { should be_true } + it { is_expected.to be_truthy } end context 'without ActiveDirectory enabled' do @@ -34,7 +34,7 @@ describe Gitlab::LDAP::Access do Gitlab::LDAP::Config.any_instance.stub(active_directory: false) end - it { should be_true } + it { is_expected.to be_truthy } end end end diff --git a/spec/lib/gitlab/ldap/adapter_spec.rb b/spec/lib/gitlab/ldap/adapter_spec.rb index 19347e47378..b609e4b38f2 100644 --- a/spec/lib/gitlab/ldap/adapter_spec.rb +++ b/spec/lib/gitlab/ldap/adapter_spec.rb @@ -12,20 +12,20 @@ describe Gitlab::LDAP::Adapter do context "and the result is non-empty" do before { ldap.stub(search: [:foo]) } - it { should be_true } + it { is_expected.to be_truthy } end context "and the result is empty" do before { ldap.stub(search: []) } - it { should be_false } + it { is_expected.to be_falsey } end end context "when the search encounters an error" do before { ldap.stub(search: nil, get_operation_result: double(code: 1, message: 'some error')) } - it { should be_false } + it { is_expected.to be_falsey } end end end diff --git a/spec/lib/gitlab/ldap/authentication_spec.rb b/spec/lib/gitlab/ldap/authentication_spec.rb index 11fdf108756..8afc2b21f46 100644 --- a/spec/lib/gitlab/ldap/authentication_spec.rb +++ b/spec/lib/gitlab/ldap/authentication_spec.rb @@ -19,7 +19,7 @@ describe Gitlab::LDAP::Authentication do klass.any_instance.stub(adapter: double(:adapter, bind_as: double(:ldap_user, dn: dn) )) - expect(klass.login(login, password)).to be_true + expect(klass.login(login, password)).to be_truthy end it "is false if the user does not exist" do @@ -27,27 +27,27 @@ describe Gitlab::LDAP::Authentication do klass.any_instance.stub(adapter: double(:adapter, bind_as: double(:ldap_user, dn: dn) )) - expect(klass.login(login, password)).to be_false + expect(klass.login(login, password)).to be_falsey end it "is false if authentication fails" do user # try only to fake the LDAP call klass.any_instance.stub(adapter: double(:adapter, bind_as: nil)) - expect(klass.login(login, password)).to be_false + expect(klass.login(login, password)).to be_falsey end it "fails if ldap is disabled" do Gitlab::LDAP::Config.stub(enabled?: false) - expect(klass.login(login, password)).to be_false + expect(klass.login(login, password)).to be_falsey end it "fails if no login is supplied" do - expect(klass.login('', password)).to be_false + expect(klass.login('', password)).to be_falsey end it "fails if no password is supplied" do - expect(klass.login(login, '')).to be_false + expect(klass.login(login, '')).to be_falsey end end end
\ No newline at end of file diff --git a/spec/lib/gitlab/ldap/config_spec.rb b/spec/lib/gitlab/ldap/config_spec.rb index 3ebb8aae243..2df2beca7a6 100644 --- a/spec/lib/gitlab/ldap/config_spec.rb +++ b/spec/lib/gitlab/ldap/config_spec.rb @@ -4,7 +4,7 @@ describe Gitlab::LDAP::Config do let(:config) { Gitlab::LDAP::Config.new provider } let(:provider) { 'ldapmain' } - describe :initalize do + describe '#initalize' do it 'requires a provider' do expect{ Gitlab::LDAP::Config.new }.to raise_error ArgumentError end diff --git a/spec/lib/gitlab/ldap/user_spec.rb b/spec/lib/gitlab/ldap/user_spec.rb index 63ffc21ba3b..4f93545feb6 100644 --- a/spec/lib/gitlab/ldap/user_spec.rb +++ b/spec/lib/gitlab/ldap/user_spec.rb @@ -16,17 +16,17 @@ describe Gitlab::LDAP::User do describe :changed? do it "marks existing ldap user as changed" do existing_user = create(:omniauth_user, extern_uid: 'my-uid', provider: 'ldapmain') - expect(gl_user.changed?).to be_true + expect(gl_user.changed?).to be_truthy end it "marks existing non-ldap user if the email matches as changed" do existing_user = create(:user, email: 'john@example.com') - expect(gl_user.changed?).to be_true + expect(gl_user.changed?).to be_truthy end it "dont marks existing ldap user as changed" do existing_user = create(:omniauth_user, email: 'john@example.com', extern_uid: 'my-uid', provider: 'ldapmain') - expect(gl_user.changed?).to be_false + expect(gl_user.changed?).to be_falsey end end |