BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
147f0428
Unverified
Commit
147f0428
authored
Jan 22, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add validation for auto_devops_domain
parent
28fd7b6c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
+45
-0
application_setting.rb
app/models/application_setting.rb
+5
-0
application_setting_spec.rb
spec/models/application_setting_spec.rb
+40
-0
No files found.
app/models/application_setting.rb
View file @
147f0428
...
...
@@ -117,6 +117,11 @@ class ApplicationSetting < ActiveRecord::Base
validates
:repository_storages
,
presence:
true
validate
:check_repository_storages
validates
:auto_devops_domain
,
allow_blank:
true
,
hostname:
{
allow_numeric_hostname:
true
,
require_valid_tld:
true
},
if: :auto_devops_enabled?
validates
:enabled_git_access_protocol
,
inclusion:
{
in:
%w(ssh http)
,
allow_blank:
true
,
allow_nil:
true
}
...
...
spec/models/application_setting_spec.rb
View file @
147f0428
...
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment