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
808fb254
Commit
808fb254
authored
Aug 30, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Raise exception when simplifiable ci entry incomplete
parent
6a5097fd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
lib/gitlab/ci/config/entry/simplifiable.rb
lib/gitlab/ci/config/entry/simplifiable.rb
+4
-0
spec/lib/gitlab/ci/config/entry/simplifiable_spec.rb
spec/lib/gitlab/ci/config/entry/simplifiable_spec.rb
+13
-0
No files found.
lib/gitlab/ci/config/entry/simplifiable.rb
View file @
808fb254
...
...
@@ -6,6 +6,10 @@ module Gitlab
EntryStrategy
=
Struct
.
new
(
:name
,
:condition
)
def
initialize
(
config
,
**
metadata
)
unless
self
.
class
.
const_defined?
(
:UnknownStrategy
)
raise
ArgumentError
,
'UndefinedStrategy not available!'
end
strategy
=
self
.
class
.
strategies
.
find
do
|
variant
|
variant
.
condition
.
call
(
config
)
end
...
...
spec/lib/gitlab/ci/config/entry/simplifiable_spec.rb
View file @
808fb254
...
...
@@ -72,4 +72,17 @@ describe Gitlab::Ci::Config::Entry::Simplifiable do
end
end
end
context
'when a unknown strategy class is not defined'
do
let
(
:entry
)
do
Class
.
new
(
described_class
)
do
strategy
:String
,
if:
->
(
*
)
{
true
}
end
end
it
'raises an error when being initialized'
do
expect
{
entry
.
new
(
'something'
)
}
.
to
raise_error
ArgumentError
,
/UndefinedStrategy not available!/
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