summaryrefslogtreecommitdiff
path: root/spec/models/application_setting_spec.rb
diff options
context:
space:
mode:
authorRoger Rüttimann <roger.ruettimann@gmail.com>2018-08-30 12:53:06 +0000
committerPhil Hughes <me@iamphill.com>2018-08-30 12:53:06 +0000
commit93b9bfd93a841b7f86e6aeab3f9c5e9ede3a4503 (patch)
tree8bfec898a33d9b0b1693e73ce27a61db54881a66 /spec/models/application_setting_spec.rb
parent3113fb848001fdea3a039295002d7752b0feebbb (diff)
downloadgitlab-ce-93b9bfd93a841b7f86e6aeab3f9c5e9ede3a4503.tar.gz
Allow whitelisting for "external collaborator by default" setting
Diffstat (limited to 'spec/models/application_setting_spec.rb')
-rw-r--r--spec/models/application_setting_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb
index 02f74e2ea54..483cc546423 100644
--- a/spec/models/application_setting_spec.rb
+++ b/spec/models/application_setting_spec.rb
@@ -538,4 +538,28 @@ describe ApplicationSetting do
expect(setting.allow_signup?).to be_falsey
end
end
+
+ describe '#user_default_internal_regex_enabled?' do
+ using RSpec::Parameterized::TableSyntax
+
+ where(:user_default_external, :user_default_internal_regex, :result) do
+ false | nil | false
+ false | '' | false
+ false | '^(?:(?!\.ext@).)*$\r?\n?' | false
+ true | '' | false
+ true | nil | false
+ true | '^(?:(?!\.ext@).)*$\r?\n?' | true
+ end
+
+ with_them do
+ before do
+ setting.update(user_default_external: user_default_external)
+ setting.update(user_default_internal_regex: user_default_internal_regex)
+ end
+
+ subject { setting.user_default_internal_regex_enabled? }
+
+ it { is_expected.to eq(result) }
+ end
+ end
end