summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/helpers/oauth_helper.rb4
-rw-r--r--app/views/devise/sessions/_oauth_providers.html.haml2
-rw-r--r--spec/helpers/oauth_helper_spec.rb17
3 files changed, 22 insertions, 1 deletions
diff --git a/app/helpers/oauth_helper.rb b/app/helpers/oauth_helper.rb
index 7024483b8b3..df18db71c84 100644
--- a/app/helpers/oauth_helper.rb
+++ b/app/helpers/oauth_helper.rb
@@ -16,4 +16,8 @@ module OauthHelper
[:twitter, :github, :google_oauth2].include?(name.to_sym)
end
end
+
+ def additional_providers
+ enabled_oauth_providers.reject{|provider| provider.to_s.starts_with?('ldap')}
+ end
end
diff --git a/app/views/devise/sessions/_oauth_providers.html.haml b/app/views/devise/sessions/_oauth_providers.html.haml
index d053c51d7ec..8d6aaefb9ff 100644
--- a/app/views/devise/sessions/_oauth_providers.html.haml
+++ b/app/views/devise/sessions/_oauth_providers.html.haml
@@ -1,4 +1,4 @@
-- providers = enabled_oauth_providers.reject{|provider| provider.to_s.starts_with?('ldap')}
+- providers = additional_providers
- if providers.present?
.bs-callout.bs-callout-info{:'data-no-turbolink' => 'data-no-turbolink'}
%span Sign in with:  
diff --git a/spec/helpers/oauth_helper_spec.rb b/spec/helpers/oauth_helper_spec.rb
new file mode 100644
index 00000000000..846e65b54e9
--- /dev/null
+++ b/spec/helpers/oauth_helper_spec.rb
@@ -0,0 +1,17 @@
+require "spec_helper"
+
+describe OauthHelper do
+ describe "additional_providers" do
+ it 'returns appropriate values' do
+ [
+ [[:twitter, :github], [:twitter, :github]],
+ [[:ldap_main], []],
+ [[:twitter, :ldap_main], [:twitter]],
+ [[], []],
+ ].each do |couple|
+ allow(helper).to receive(:enabled_oauth_providers) { couple.first }
+ additional_providers.should include(*couple.last)
+ end
+ end
+ end
+end \ No newline at end of file