BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
3da57c80
Commit
3da57c80
authored
Jul 07, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Require reference to CI config for some entries
parent
f067202e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
9 deletions
+29
-9
stage.rb
lib/gitlab/ci/config/node/stage.rb
+7
-0
stage_spec.rb
spec/lib/gitlab/ci/config/node/stage_spec.rb
+22
-9
No files found.
lib/gitlab/ci/config/node/stage.rb
View file @
3da57c80
...
...
@@ -10,6 +10,13 @@ module Gitlab
validations
do
validates
:config
,
key:
true
validate
do
|
entry
|
unless
entry
.
global
raise
Entry
::
InvalidError
,
'This entry needs reference to global configuration'
end
end
end
def
self
.
default
...
...
spec/lib/gitlab/ci/config/node/stage_spec.rb
View file @
3da57c80
require
'spec_helper'
describe
Gitlab
::
Ci
::
Config
::
Node
::
Stage
do
let
(
:entry
)
{
described_class
.
new
(
config
)
}
let
(
:entry
)
{
described_class
.
new
(
config
,
global:
global
)
}
let
(
:global
)
{
spy
(
'Global'
)
}
describe
'validations'
do
context
'when entry config value is correct'
do
let
(
:config
)
{
:
stage1
}
let
(
:config
)
{
:
build
}
describe
'#value'
do
it
'returns a stage key'
do
...
...
@@ -18,20 +19,32 @@ describe Gitlab::Ci::Config::Node::Stage do
expect
(
entry
).
to
be_valid
end
end
end
context
'when entry config is incorrect'
do
describe
'#errors'
do
context
'when reference to global node is not set'
do
let
(
:entry
)
{
described_class
.
new
(
config
)
}
it
'raises error'
do
expect
{
entry
}
.
to
raise_error
Gitlab
::
Ci
::
Config
::
Node
::
Entry
::
InvalidError
end
end
context
'when entry config is incorrect
'
do
let
(
:config
)
{
{
test:
true
}
}
context
'when value has a wrong type
'
do
let
(
:config
)
{
{
test:
true
}
}
describe
'#errors'
do
it
'reports errors'
do
it
'reports errors about wrong type'
do
expect
(
entry
.
errors
)
.
to
include
'stage config should be a string or symbol'
end
end
describe
'#valid?'
do
it
'is not valid'
do
expect
(
entry
).
not_to
be_valid
context
'when stage is not present in global configuration'
do
pending
'reports error about missing stage'
do
expect
(
entry
.
errors
)
.
to
include
'stage config should be one of test, stage'
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