Commit b56b96d4 authored by Valery Sizov's avatar Valery Sizov

added helper

parent 3a5ed526
...@@ -16,4 +16,8 @@ module OauthHelper ...@@ -16,4 +16,8 @@ module OauthHelper
[:twitter, :github, :google_oauth2].include?(name.to_sym) [:twitter, :github, :google_oauth2].include?(name.to_sym)
end end
end end
def additional_providers
enabled_oauth_providers.reject{|provider| provider.to_s.starts_with?('ldap')}
end
end end
- providers = enabled_oauth_providers.reject{|provider| provider.to_s.starts_with?('ldap')} - providers = additional_providers
- if providers.present? - if providers.present?
.bs-callout.bs-callout-info{:'data-no-turbolink' => 'data-no-turbolink'} .bs-callout.bs-callout-info{:'data-no-turbolink' => 'data-no-turbolink'}
%span Sign in with:   %span Sign in with:  
......
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
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