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
Jérome Perrin
gitlab-ce
Commits
1bf87d25
Commit
1bf87d25
authored
Aug 30, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused expressions policy from ci/cd config
parent
3474e109
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
39 deletions
+0
-39
lib/gitlab/ci/config/entry/policy.rb
lib/gitlab/ci/config/entry/policy.rb
+0
-19
spec/lib/gitlab/ci/config/entry/policy_spec.rb
spec/lib/gitlab/ci/config/entry/policy_spec.rb
+0
-20
No files found.
lib/gitlab/ci/config/entry/policy.rb
View file @
1bf87d25
...
...
@@ -7,7 +7,6 @@ module Gitlab
#
class
Policy
<
Simplifiable
strategy
:RefsPolicy
,
if:
->
(
config
)
{
config
.
is_a?
(
Array
)
}
strategy
:ExpressionsPolicy
,
if:
->
(
config
)
{
config
.
is_a?
(
Hash
)
}
class
RefsPolicy
<
Entry
::
Node
include
Entry
::
Validatable
...
...
@@ -17,24 +16,6 @@ module Gitlab
end
end
class
ExpressionsPolicy
<
Entry
::
Node
include
Entry
::
Validatable
include
Entry
::
Attributable
attributes
:refs
,
:expressions
validations
do
validates
:config
,
presence:
true
validates
:config
,
allowed_keys:
%i[refs expressions]
with_options
allow_nil:
true
do
validates
:refs
,
array_of_strings_or_regexps:
true
validates
:expressions
,
type:
Array
validates
:expressions
,
presence:
true
end
end
end
class
UnknownStrategy
<
Entry
::
Node
def
errors
[
"
#{
location
}
has to be either an array of conditions or a hash"
]
...
...
spec/lib/gitlab/ci/config/entry/policy_spec.rb
View file @
1bf87d25
...
...
@@ -56,26 +56,6 @@ describe Gitlab::Ci::Config::Entry::Policy do
end
end
context
'when using complex policy'
do
context
'when it is an empty hash'
do
let
(
:config
)
{
{}
}
it
'reports an error about configuration not being present'
do
expect
(
entry
.
errors
).
to
include
/can't be blank/
end
end
context
'when it contains unknown keys'
do
let
(
:config
)
{
{
refs:
[
'something'
],
invalid:
'master'
}
}
it
'is not valid entry'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
)
.
to
include
/policy config contains unknown keys: invalid/
end
end
end
context
'when policy strategy does not match'
do
let
(
:config
)
{
'string strategy'
}
...
...
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