summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-01-22 19:29:15 +0100
committerMatija Čupić <matteeyah@gmail.com>2018-01-22 19:29:15 +0100
commit147f0428c00e7a10e908438a99a1558c24be41f4 (patch)
treecf4bdb394070a5da70296526c973f6200dd6b121 /spec
parent28fd7b6c5df43b2f29557e813055deb438791c67 (diff)
downloadgitlab-ce-147f0428c00e7a10e908438a99a1558c24be41f4.tar.gz
Add validation for auto_devops_domain
Diffstat (limited to 'spec')
-rw-r--r--spec/models/application_setting_spec.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb
index ef480e7a80a..0d7b98229a4 100644
--- a/spec/models/application_setting_spec.rb
+++ b/spec/models/application_setting_spec.rb
@@ -114,6 +114,46 @@ describe ApplicationSetting do
it { expect(setting.repository_storages).to eq(['default']) }
end
+ context 'auto_devops_domain setting' do
+ context 'when auto_devops_enabled? is true' do
+ before do
+ setting.update(auto_devops_enabled: true)
+ end
+
+ context 'with a valid value' do
+ before do
+ setting.update(auto_devops_domain: 'domain.com')
+ end
+
+ it 'is valid' do
+ expect(setting).to be_valid
+ end
+ end
+
+ context 'with an invalid value' do
+ before do
+ setting.update(auto_devops_domain: 'definitelynotahostname')
+ end
+
+ it 'is invalid' do
+ expect(setting).to be_invalid
+ end
+ end
+ end
+
+ context 'when auto_devops_enabled? is false' do
+ before do
+ setting.update(auto_devops_enabled: false)
+ end
+
+ it 'can be blank' do
+ setting.update(auto_devops_domain: '')
+
+ expect(setting).to be_valid
+ end
+ end
+ end
+
context 'circuitbreaker settings' do
[:circuitbreaker_failure_count_threshold,
:circuitbreaker_check_interval,