Commit 9e8238d9 authored by Lucas Charles's avatar Lucas Charles

De-duplicate auth helper EE specs

Part of https://gitlab.com/gitlab-org/gitlab/-/issues/211887
parent 68d82ed0
......@@ -221,10 +221,8 @@ GitlabSecurity/PublicSend:
Gitlab/DuplicateSpecLocation:
Exclude:
- ee/spec/helpers/auth_helper_spec.rb
- ee/spec/lib/gitlab/gl_repository_spec.rb
- ee/spec/services/merge_requests/refresh_service_spec.rb
- ee/spec/helpers/ee/auth_helper_spec.rb
- ee/spec/services/ee/merge_requests/refresh_service_spec.rb
Cop/InjectEnterpriseEditionModule:
......
# frozen_string_literal: true
require "spec_helper"
describe AuthHelper do
describe "button_based_providers" do
it 'excludes group_saml' do
allow(helper).to receive(:auth_providers) { [:group_saml] }
expect(helper.button_based_providers).to eq([])
end
end
describe "providers_for_base_controller" do
it 'excludes group_saml' do
allow(helper).to receive(:auth_providers) { [:group_saml] }
expect(helper.providers_for_base_controller).to eq([])
end
end
describe "form_based_providers" do
it 'includes kerberos provider' do
allow(helper).to receive(:auth_providers) { [:twitter, :kerberos] }
expect(helper.form_based_providers).to eq %i(kerberos)
end
end
describe 'form_based_auth_provider_has_active_class?' do
it 'selects main LDAP server' do
allow(helper).to receive(:auth_providers) { [:twitter, :ldapprimary, :ldapsecondary, :kerberos] }
expect(helper.form_based_auth_provider_has_active_class?(:twitter)).to be(false)
expect(helper.form_based_auth_provider_has_active_class?(:ldapprimary)).to be(true)
expect(helper.form_based_auth_provider_has_active_class?(:ldapsecondary)).to be(false)
expect(helper.form_based_auth_provider_has_active_class?(:kerberos)).to be(false)
end
end
end
......@@ -3,6 +3,37 @@
require 'spec_helper'
describe EE::AuthHelper do
describe "button_based_providers" do
it 'excludes group_saml' do
allow(helper).to receive(:auth_providers) { [:group_saml] }
expect(helper.button_based_providers).to eq([])
end
end
describe "providers_for_base_controller" do
it 'excludes group_saml' do
allow(helper).to receive(:auth_providers) { [:group_saml] }
expect(helper.providers_for_base_controller).to eq([])
end
end
describe "form_based_providers" do
it 'includes kerberos provider' do
allow(helper).to receive(:auth_providers) { [:twitter, :kerberos] }
expect(helper.form_based_providers).to eq %i(kerberos)
end
end
describe 'form_based_auth_provider_has_active_class?' do
it 'selects main LDAP server' do
allow(helper).to receive(:auth_providers) { [:twitter, :ldapprimary, :ldapsecondary, :kerberos] }
expect(helper.form_based_auth_provider_has_active_class?(:twitter)).to be(false)
expect(helper.form_based_auth_provider_has_active_class?(:ldapprimary)).to be(true)
expect(helper.form_based_auth_provider_has_active_class?(:ldapsecondary)).to be(false)
expect(helper.form_based_auth_provider_has_active_class?(:kerberos)).to be(false)
end
end
describe "form_based_providers" do
context 'with smartcard_auth feature flag off' do
before 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