summaryrefslogtreecommitdiff
path: root/spec/helpers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-05 21:08:13 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-05 21:08:13 +0000
commitd3c29eae5c389e36d4751539fad0462053fb2b20 (patch)
treecc3ae497193f9334d0bc6ee4224637102f6e0d4e /spec/helpers
parentad4dbe36445360521fc73a57df13bc8f12eeaa92 (diff)
downloadgitlab-ce-d3c29eae5c389e36d4751539fad0462053fb2b20.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/auth_helper_spec.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/helpers/auth_helper_spec.rb b/spec/helpers/auth_helper_spec.rb
index 9179019cd6a..073ce581741 100644
--- a/spec/helpers/auth_helper_spec.rb
+++ b/spec/helpers/auth_helper_spec.rb
@@ -154,4 +154,34 @@ describe AuthHelper do
expect(helper.unlink_provider_allowed?(provider)).to eq 'policy_unlink_result'
end
end
+
+ describe '#provider_has_icon?' do
+ it 'returns true for defined providers' do
+ expect(helper.provider_has_icon?(described_class::PROVIDERS_WITH_ICONS.sample)).to eq true
+ end
+
+ it 'returns false for undefined providers' do
+ expect(helper.provider_has_icon?('test')).to be_falsey
+ end
+
+ context 'when provider is defined by config' do
+ before do
+ allow(Gitlab::Auth::OAuth::Provider).to receive(:icon_for).with('test').and_return('icon')
+ end
+
+ it 'returns true' do
+ expect(helper.provider_has_icon?('test')).to be_truthy
+ end
+ end
+
+ context 'when provider is not defined by config' do
+ before do
+ allow(Gitlab::Auth::OAuth::Provider).to receive(:icon_for).with('test').and_return(nil)
+ end
+
+ it 'returns true' do
+ expect(helper.provider_has_icon?('test')).to be_falsey
+ end
+ end
+ end
end