summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorAndrei Gliga <otzy_007@yahoo.com>2016-05-04 17:06:07 +0300
committerAndrei Gliga <otzy_007@yahoo.com>2016-05-12 13:44:46 +0300
commit6f69f6a1ab70bd2252803a64927d0c8df1d03612 (patch)
treeed82e5acc3571eb9d26e1461725d2df1748e1a72 /spec
parent8c2b72b1c80e8bbd082ac8e1aedb21a1aad07235 (diff)
downloadgitlab-ce-6f69f6a1ab70bd2252803a64927d0c8df1d03612.tar.gz
tests for button_based_providers_enabled? helper method of AuthHelper
Diffstat (limited to 'spec')
-rw-r--r--spec/helpers/auth_helper_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/helpers/auth_helper_spec.rb b/spec/helpers/auth_helper_spec.rb
index 5d66c92d26e..a6a366bc19a 100644
--- a/spec/helpers/auth_helper_spec.rb
+++ b/spec/helpers/auth_helper_spec.rb
@@ -36,5 +36,23 @@ describe AuthHelper do
expect(helper.enabled_button_based_providers).to include('twitter')
expect(helper.enabled_button_based_providers).to_not include('github')
end
+
+ it 'returns true for button_based_providers_enabled? because there providers' do
+ allow(helper).to receive(:auth_providers) { [:twitter, :github] }
+
+ expect(helper.button_based_providers_enabled?).to be true
+ end
+
+ it 'returns false for button_based_providers_enabled? because there providers' do
+ settings.update_attribute(
+ :disabled_oauth_sign_in_sources,
+ ['github', 'twitter']
+ )
+
+ allow(helper).to receive(:auth_providers) { [:twitter, :github] }
+ allow(helper).to receive(:current_application_settings) { settings }
+
+ expect(helper.button_based_providers_enabled?).to be false
+ end
end
end