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
path: root/spec/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-05-31 14:45:01 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-31 14:45:27 +0300
commit185d6a2578f64ffafd80bea5314915811a54486a (patch)
tree90d435f1c353da19b799046f66aa7abbf1bd778d /spec/lib
parent4530f5d0bdc9b2f60eed2146eaf1b6f35fc53b0e (diff)
Add latest changes from gitlab-org/security/gitlab@13-12-stable-ee
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/current_settings_spec.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/lib/gitlab/current_settings_spec.rb b/spec/lib/gitlab/current_settings_spec.rb
index f5cb1987c5c..a5ab1047a40 100644
--- a/spec/lib/gitlab/current_settings_spec.rb
+++ b/spec/lib/gitlab/current_settings_spec.rb
@@ -24,6 +24,42 @@ RSpec.describe Gitlab::CurrentSettings do
end
end
+ describe '.signup_limited?' do
+ subject { described_class.signup_limited? }
+
+ context 'when there are allowed domains' do
+ before do
+ create(:application_setting, domain_allowlist: ['www.gitlab.com'])
+ end
+
+ it { is_expected.to be_truthy }
+ end
+
+ context 'when there are email restrictions' do
+ before do
+ create(:application_setting, email_restrictions_enabled: true)
+ end
+
+ it { is_expected.to be_truthy }
+ end
+
+ context 'when the admin has to approve signups' do
+ before do
+ create(:application_setting, require_admin_approval_after_user_signup: true)
+ end
+
+ it { is_expected.to be_truthy }
+ end
+
+ context 'when there are no restrictions' do
+ before do
+ create(:application_setting, domain_allowlist: [], email_restrictions_enabled: false, require_admin_approval_after_user_signup: false)
+ end
+
+ it { is_expected.to be_falsey }
+ end
+ end
+
describe '.signup_disabled?' do
subject { described_class.signup_disabled? }