Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-05-12 18:10:25 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-12 18:10:25 +0300
commit4a882000a94d1043b536e078a0e3571bdb0077d3 (patch)
treefe727bab83189a7a0f4ed72d879902e70a9d46a3 /spec/helpers
parent71a67d17b02e7b8dec2f4c257f6734dc7818fb1e (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/auth_helper_spec.rb14
-rw-r--r--spec/helpers/registrations_helper_spec.rb29
2 files changed, 36 insertions, 7 deletions
diff --git a/spec/helpers/auth_helper_spec.rb b/spec/helpers/auth_helper_spec.rb
index 5194285b965..c1c961c5cbb 100644
--- a/spec/helpers/auth_helper_spec.rb
+++ b/spec/helpers/auth_helper_spec.rb
@@ -77,8 +77,8 @@ RSpec.describe AuthHelper do
end
context 'all providers are enabled to sign in' do
- it 'returns all the enabled providers from settings' do
- expect(helper.enabled_button_based_providers).to include('twitter', 'github', 'google_oauth2', 'openid_connect')
+ it 'returns all the enabled providers from settings in expected order' do
+ expect(helper.enabled_button_based_providers).to match(%w[google_oauth2 github twitter openid_connect])
end
it 'puts google and github in the beginning' do
@@ -99,19 +99,19 @@ RSpec.describe AuthHelper do
end
end
- describe 'trial_enabled_button_based_providers' do
- it 'returns the intersection set of github & google_oauth2 with enabled providers' do
+ describe 'popular_enabled_button_based_providers' do
+ it 'returns the intersection set of popular & enabled providers', :aggregate_failures do
allow(helper).to receive(:enabled_button_based_providers) { %w(twitter github google_oauth2) }
- expect(helper.trial_enabled_button_based_providers).to eq(%w(github google_oauth2))
+ expect(helper.popular_enabled_button_based_providers).to eq(%w(github google_oauth2))
allow(helper).to receive(:enabled_button_based_providers) { %w(google_oauth2 bitbucket) }
- expect(helper.trial_enabled_button_based_providers).to eq(%w(google_oauth2))
+ expect(helper.popular_enabled_button_based_providers).to eq(%w(google_oauth2))
allow(helper).to receive(:enabled_button_based_providers) { %w(bitbucket) }
- expect(helper.trial_enabled_button_based_providers).to be_empty
+ expect(helper.popular_enabled_button_based_providers).to be_empty
end
end
diff --git a/spec/helpers/registrations_helper_spec.rb b/spec/helpers/registrations_helper_spec.rb
new file mode 100644
index 00000000000..00d0a0850cd
--- /dev/null
+++ b/spec/helpers/registrations_helper_spec.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe RegistrationsHelper do
+ using RSpec::Parameterized::TableSyntax
+
+ describe '#social_signin_enabled?' do
+ before do
+ allow(::Gitlab).to receive(:dev_env_or_com?).and_return(com)
+ allow(view).to receive(:omniauth_enabled?).and_return(omniauth_enabled)
+ allow(view).to receive(:button_based_providers_enabled?).and_return(button_based_providers_enabled)
+ allow(view).to receive(:devise_mapping).and_return(double(omniauthable?: omniauthable))
+ end
+
+ subject { helper.social_signin_enabled? }
+
+ where com: [true, false],
+ omniauth_enabled: [true, false],
+ omniauthable: [true, false],
+ button_based_providers_enabled: [true, false]
+
+ with_them do
+ let(:result) { com && omniauth_enabled && button_based_providers_enabled && omniauthable }
+
+ it { is_expected.to eq(result) }
+ end
+ end
+end