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
652ecff9
Commit
652ecff9
authored
Sep 26, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for builder chain that persist a pipeline
parent
2432d5bd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
0 deletions
+66
-0
create_spec.rb
spec/lib/gitlab/ci/pipeline/chain/create_spec.rb
+66
-0
No files found.
spec/lib/gitlab/ci/pipeline/chain/create_spec.rb
0 → 100644
View file @
652ecff9
require
'spec_helper'
describe
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Create
do
set
(
:project
)
{
create
(
:project
)
}
set
(
:user
)
{
create
(
:user
)
}
let
(
:pipeline
)
do
build
(
:ci_pipeline_with_one_job
,
project:
project
,
ref:
'master'
)
end
let
(
:command
)
do
double
(
'command'
,
project:
project
,
current_user:
user
,
seeds_block:
nil
)
end
let
(
:step
)
{
described_class
.
new
(
pipeline
,
command
)
}
before
do
step
.
perform!
end
context
'when pipeline is ready to be saved'
do
it
'saves a pipeline'
do
expect
(
pipeline
).
to
be_persisted
end
it
'does not break the chain'
do
expect
(
step
.
break?
).
to
be
false
end
it
'creates stages'
do
expect
(
pipeline
.
reload
.
stages
).
to
be_one
end
end
context
'when pipeline has validation errors'
do
let
(
:pipeline
)
do
build
(
:ci_pipeline
,
project:
project
,
ref:
nil
)
end
it
'breaks the chain'
do
expect
(
step
.
break?
).
to
be
true
end
it
'appends validation error'
do
expect
(
pipeline
.
errors
.
to_a
)
.
to
include
/Failed to persist the pipeline/
end
end
context
'when there is a seed block present'
do
let
(
:seeds
)
{
spy
(
'pipeline seeds'
)
}
let
(
:command
)
do
double
(
'command'
,
project:
project
,
current_user:
user
,
seeds_block:
seeds
)
end
it
'executes the block'
do
expect
(
seeds
).
to
have_received
(
:call
).
with
(
pipeline
)
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