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
835bdcb8
Commit
835bdcb8
authored
Sep 26, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for pipeline chain builder sequence class
parent
f6bd832f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
0 deletions
+55
-0
spec/lib/gitlab/ci/pipeline/chain/sequence_spec.rb
spec/lib/gitlab/ci/pipeline/chain/sequence_spec.rb
+55
-0
No files found.
spec/lib/gitlab/ci/pipeline/chain/sequence_spec.rb
0 → 100644
View file @
835bdcb8
require
'spec_helper'
describe
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Sequence
do
set
(
:project
)
{
create
(
:project
)
}
set
(
:user
)
{
create
(
:user
)
}
let
(
:pipeline
)
{
build_stubbed
(
:ci_pipeline
)
}
let
(
:command
)
{
double
(
'command'
)
}
let
(
:first_step
)
{
spy
(
'first step'
)
}
let
(
:second_step
)
{
spy
(
'second step'
)
}
let
(
:sequence
)
{
[
first_step
,
second_step
]
}
subject
do
described_class
.
new
(
pipeline
,
command
,
sequence
)
end
context
'when one of steps breaks the chain'
do
before
do
allow
(
first_step
).
to
receive
(
:break?
).
and_return
(
true
)
end
it
'does not process the second step'
do
subject
.
build!
do
|
pipeline
,
sequence
|
expect
(
sequence
).
not_to
be_complete
end
expect
(
second_step
).
not_to
have_received
(
:perform!
)
end
it
'returns a pipeline object'
do
expect
(
subject
.
build!
).
to
eq
pipeline
end
end
context
'when all chains are executed correctly'
do
before
do
sequence
.
each
do
|
step
|
allow
(
step
).
to
receive
(
:break?
).
and_return
(
false
)
end
end
it
'iterates through entire sequence'
do
subject
.
build!
do
|
pipeline
,
sequence
|
expect
(
sequence
).
to
be_complete
end
expect
(
first_step
).
to
have_received
(
:perform!
)
expect
(
second_step
).
to
have_received
(
:perform!
)
end
it
'returns a pipeline object'
do
expect
(
subject
.
build!
).
to
eq
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