summaryrefslogtreecommitdiff
path: root/spec/helpers/admin/identities_helper_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 08:17:02 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 08:17:02 +0000
commitb39512ed755239198a9c294b6a45e65c05900235 (patch)
treed234a3efade1de67c46b9e5a38ce813627726aa7 /spec/helpers/admin/identities_helper_spec.rb
parentd31474cf3b17ece37939d20082b07f6657cc79a9 (diff)
downloadgitlab-ce-b39512ed755239198a9c294b6a45e65c05900235.tar.gz
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'spec/helpers/admin/identities_helper_spec.rb')
-rw-r--r--spec/helpers/admin/identities_helper_spec.rb58
1 files changed, 58 insertions, 0 deletions
diff --git a/spec/helpers/admin/identities_helper_spec.rb b/spec/helpers/admin/identities_helper_spec.rb
new file mode 100644
index 00000000000..9a7fdd3aa69
--- /dev/null
+++ b/spec/helpers/admin/identities_helper_spec.rb
@@ -0,0 +1,58 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Admin::IdentitiesHelper do
+ let_it_be(:user) { create(:user) }
+ let_it_be(:identity) { create(:identity, provider: 'ldapmain', extern_uid: 'ldap-uid') }
+
+ describe '#label_for_identity_provider' do
+ it 'shows label for identity provider' do
+ expect(helper.label_for_identity_provider(identity)).to eq 'ldap (ldapmain)'
+ end
+ end
+
+ describe '#provider_id_cell_testid' do
+ it 'shows blank provider id for data-testid' do
+ expect(helper.provider_id_cell_testid(identity)).to eq 'provider_id_blank'
+ end
+ end
+
+ describe '#provider_id' do
+ it 'shows no provider id' do
+ expect(helper.provider_id(identity)).to eq '-'
+ end
+ end
+
+ describe '#saml_group_cell_testid' do
+ it 'shows blank SAML group for data-testid' do
+ expect(helper.saml_group_cell_testid(identity)).to eq 'saml_group_blank'
+ end
+ end
+
+ describe '#saml_group_link' do
+ it 'shows no link to SAML group' do
+ expect(helper.saml_group_link(identity)).to eq '-'
+ end
+ end
+
+ describe '#identity_cells_to_render?' do
+ context 'without identities' do
+ it 'returns false' do
+ expect(helper.identity_cells_to_render?([], user)).to eq false
+ end
+ end
+
+ context 'with identities' do
+ it 'returns true' do
+ expect(helper.identity_cells_to_render?(identity, user)).to eq true
+ end
+ end
+ end
+
+ describe '#scim_identities_collection' do
+ it 'returns empty array' do
+ expect(helper.scim_identities_collection(user)).to eq []
+ end
+ end
+end