Extract EE specific files/lines for Manage spec/helpers
We have the following files containing EE specific code. We should move them to ee/
spec/helpers/appearances_helper_spec.rb
diff --git a/spec/helpers/appearances_helper_spec.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/helpers/appearances_helper_spec.rb
index 8d717b968dd..943e0afa6bd 100644
--- a/spec/helpers/appearances_helper_spec.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/helpers/appearances_helper_spec.rb
@@ -70,7 +70,7 @@ describe AppearancesHelper do
.to receive(:current_appearance)
.and_return(nil)
- expect(helper.brand_title).to eq('GitLab Community Edition')
+ expect(helper.brand_title).to eq('GitLab Enterprise Edition')
end
end
end
spec/helpers/auth_helper_spec.rb
diff --git a/spec/helpers/auth_helper_spec.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/helpers/auth_helper_spec.rb
index f0c2e4768ec..344debdd77d 100644
--- a/spec/helpers/auth_helper_spec.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/helpers/auth_helper_spec.rb
@@ -12,6 +12,11 @@ describe AuthHelper do
expect(helper.button_based_providers).to include(:twitter)
end
+ it 'excludes group_saml' do
+ allow(helper).to receive(:auth_providers) { [:group_saml] }
+ expect(helper.button_based_providers).to eq([])
+ end
+
it 'returns empty array' do
allow(helper).to receive(:auth_providers) { [] }
expect(helper.button_based_providers).to eq([])
@@ -28,6 +33,11 @@ describe AuthHelper do
allow(helper).to receive(:auth_providers) { [:twitter, :ldapmain] }
expect(helper.providers_for_base_controller).not_to include(:ldapmain)
end
+
+ 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
@@ -40,6 +50,21 @@ describe AuthHelper do
allow(helper).to receive(:auth_providers) { [:twitter, :crowd] }
expect(helper.form_based_providers).to eq %i(crowd)
end
+
+ 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_auth_provider_has_active_class?' do
spec/helpers/groups_helper_spec.rb
diff --git a/spec/helpers/groups_helper_spec.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/helpers/groups_helper_spec.rb
index 540a8674ec2..9e654b48b74 100644
--- a/spec/helpers/groups_helper_spec.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/helpers/groups_helper_spec.rb
@@ -90,7 +90,7 @@ describe GroupsHelper do
let(:deep_nested_group) { create(:group, parent: nested_group) }
let!(:very_deep_nested_group) { create(:group, parent: deep_nested_group) }
- it 'outputs the groups in the correct order' do
+ it 'outputs the groups in the correct order', :postgresql do
expect(helper.group_title(very_deep_nested_group))
.to match(%r{<li style="text-indent: 16px;"><a.*>#{deep_nested_group.name}.*</li>.*<a.*>#{very_deep_nested_group.name}</a>}m)
end
spec/helpers/projects_helper_spec.rb
diff --git a/spec/helpers/projects_helper_spec.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/helpers/projects_helper_spec.rb
index 49895b0680b..a1744706c0c 100644
--- a/spec/helpers/projects_helper_spec.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/spec/helpers/projects_helper_spec.rb
@@ -300,6 +300,15 @@ describe ProjectsHelper do
expect(helper.send(:default_clone_protocol)).to eq('https')
end
end
+
+ context 'when gitlab.config.kerberos is enabled and user is logged in' do
+ it 'returns krb5 as default protocol' do
+ allow(Gitlab.config.kerberos).to receive(:enabled).and_return(true)
+ allow(helper).to receive(:current_user).and_return(double)
+
+ expect(helper.send(:default_clone_protocol)).to eq('krb5')
+ end
+ end
end
describe '#last_push_event' do