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
84c14ac0
Commit
84c14ac0
authored
Feb 14, 2018
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve validation message and add changelog
parent
48db60e4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
2 deletions
+7
-2
app/validators/variable_duplicates_validator.rb
app/validators/variable_duplicates_validator.rb
+1
-1
changelogs/unreleased/fix-validation-of-environment-scope-for-variables.yml
...sed/fix-validation-of-environment-scope-for-variables.yml
+5
-0
spec/support/features/variable_list_shared_examples.rb
spec/support/features/variable_list_shared_examples.rb
+1
-1
No files found.
app/validators/variable_duplicates_validator.rb
View file @
84c14ac0
...
...
@@ -20,7 +20,7 @@ class VariableDuplicatesValidator < ActiveModel::EachValidator
def
validate_duplicates
(
record
,
attribute
,
values
)
duplicates
=
values
.
reject
(
&
:marked_for_destruction?
).
group_by
(
&
:key
).
select
{
|
_
,
v
|
v
.
many?
}.
map
(
&
:first
)
if
duplicates
.
any?
error_message
=
"ha
s duplicate variabl
es (
#{
duplicates
.
join
(
", "
)
}
)"
error_message
=
"ha
ve duplicate valu
es (
#{
duplicates
.
join
(
", "
)
}
)"
error_message
+=
" for
#{
values
.
first
.
send
(
options
[
:scope
])
}
scope"
if
options
[
:scope
]
# rubocop:disable GitlabSecurity/PublicSend
record
.
errors
.
add
(
attribute
,
error_message
)
end
...
...
changelogs/unreleased/fix-validation-of-environment-scope-for-variables.yml
0 → 100644
View file @
84c14ac0
---
title
:
Fix validation of environment scope of variables
merge_request
:
author
:
type
:
fixed
spec/support/features/variable_list_shared_examples.rb
View file @
84c14ac0
...
...
@@ -263,7 +263,7 @@ shared_examples 'variable list' do
# We check the first row because it re-sorts to alphabetical order on refresh
page
.
within
(
'.js-ci-variable-list-section'
)
do
expect
(
find
(
'.js-ci-variable-error-box'
)).
to
have_content
(
/Validation failed Variables ha
s duplicate variabl
es \(.+\)/
)
expect
(
find
(
'.js-ci-variable-error-box'
)).
to
have_content
(
/Validation failed Variables ha
ve duplicate valu
es \(.+\)/
)
end
end
end
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