Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
147f0428
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
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
+45
-0
app/models/application_setting.rb
app/models/application_setting.rb
+5
-0
spec/models/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
...
@@ -117,6 +117,11 @@ class ApplicationSetting < ActiveRecord::Base
validates
:repository_storages
,
presence:
true
validates
:repository_storages
,
presence:
true
validate
:check_repository_storages
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
,
validates
:enabled_git_access_protocol
,
inclusion:
{
in:
%w(ssh http)
,
allow_blank:
true
,
allow_nil:
true
}
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
...
@@ -114,6 +114,46 @@ describe ApplicationSetting do
it
{
expect
(
setting
.
repository_storages
).
to
eq
([
'default'
])
}
it
{
expect
(
setting
.
repository_storages
).
to
eq
([
'default'
])
}
end
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
context
'circuitbreaker settings'
do
[
:circuitbreaker_failure_count_threshold
,
[
:circuitbreaker_failure_count_threshold
,
:circuitbreaker_check_interval
,
: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