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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
ec3b5087
Commit
ec3b5087
authored
Oct 23, 2019
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor validation error messages
parent
c1cb7907
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
6 deletions
+5
-6
ee/lib/ee/gitlab/ci/config/entry/bridge.rb
ee/lib/ee/gitlab/ci/config/entry/bridge.rb
+2
-3
ee/spec/lib/ee/gitlab/ci/config/entry/bridge_spec.rb
ee/spec/lib/ee/gitlab/ci/config/entry/bridge_spec.rb
+1
-1
ee/spec/lib/gitlab/ci/config/entry/job_spec.rb
ee/spec/lib/gitlab/ci/config/entry/job_spec.rb
+1
-1
lib/gitlab/ci/config/entry/needs.rb
lib/gitlab/ci/config/entry/needs.rb
+1
-1
No files found.
ee/lib/ee/gitlab/ci/config/entry/bridge.rb
View file @
ec3b5087
...
...
@@ -38,10 +38,9 @@ module EE
validate
on: :composed
do
next
unless
bridge_needs
.
present?
next
if
bridge_needs
.
one?
unless
bridge_needs
.
one?
errors
.
add
(
:config
,
'should contain exactly one bridge need'
)
end
errors
.
add
(
:config
,
'should contain at most one bridge need'
)
end
end
...
...
ee/spec/lib/ee/gitlab/ci/config/entry/bridge_spec.rb
View file @
ec3b5087
...
...
@@ -199,7 +199,7 @@ describe EE::Gitlab::Ci::Config::Entry::Bridge do
describe
'#errors'
do
it
'returns an error about too many bridge needs'
do
expect
(
subject
.
errors
).
to
contain_exactly
(
'bridge config should contain
exactly
one bridge need'
)
expect
(
subject
.
errors
).
to
contain_exactly
(
'bridge config should contain
at most
one bridge need'
)
end
end
end
...
...
ee/spec/lib/gitlab/ci/config/entry/job_spec.rb
View file @
ec3b5087
...
...
@@ -23,7 +23,7 @@ describe Gitlab::Ci::Config::Entry::Job do
it
'returns error about invalid needs type'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
).
to
contain_exactly
(
'needs config uses
bridge type(s)
'
)
expect
(
entry
.
errors
).
to
contain_exactly
(
'needs config uses
invalid types: bridge
'
)
end
end
end
...
...
lib/gitlab/ci/config/entry/needs.rb
View file @
ec3b5087
...
...
@@ -22,7 +22,7 @@ module Gitlab
validate
on: :composed
do
extra_keys
=
value
.
keys
-
opt
(
:allowed_needs
)
if
extra_keys
.
any?
errors
.
add
(
:config
,
"uses
#{
extra_keys
.
join
(
', '
)
}
type(s)
"
)
errors
.
add
(
:config
,
"uses
invalid types:
#{
extra_keys
.
join
(
', '
)
}
"
)
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