Commit 3bccf2fd authored by Michael Kozono's avatar Michael Kozono

Refactor with LDAP spec helpers

parent a27b4f74
require 'spec_helper'
describe Gitlab::LDAP::User do
include LdapHelpers
let(:ldap_user) { described_class.new(auth_hash) }
let(:gl_user) { ldap_user.gl_user }
let(:info) do
......@@ -174,8 +176,7 @@ describe Gitlab::LDAP::User do
describe 'blocking' do
def configure_block(value)
allow_any_instance_of(Gitlab::LDAP::Config)
.to receive(:block_auto_created_users).and_return(value)
stub_ldap_config(block_auto_created_users: value)
end
context 'signup' do
......@@ -268,7 +269,7 @@ describe Gitlab::LDAP::User do
describe '#in_any_external_group?' do
context 'when there is an external group' do
before do
expect_any_instance_of(Gitlab::LDAP::Config).to receive(:external_groups).and_return(['foo'])
stub_ldap_config(external_groups: ['foo'])
end
context 'when the user is in an external group' do
......@@ -294,7 +295,7 @@ describe Gitlab::LDAP::User do
context 'when are no external groups' do
before do
expect_any_instance_of(Gitlab::LDAP::Config).to receive(:external_groups).and_return([])
stub_ldap_config(external_groups: [])
end
it 'returns false' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment