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
e66b0414
Commit
e66b0414
authored
Jan 18, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve readability of specs for pipeline stages
parent
cff9c16b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
23 deletions
+48
-23
pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+48
-23
No files found.
spec/models/ci/pipeline_spec.rb
View file @
e66b0414
...
...
@@ -122,14 +122,34 @@ describe Ci::Pipeline, models: true do
end
end
describe
'
#
stages'
do
describe
'
pipeline
stages'
do
before
do
create
(
:commit_status
,
pipeline:
pipeline
,
stage:
'build'
,
name:
'linux'
,
stage_idx:
0
,
status:
'success'
)
create
(
:commit_status
,
pipeline:
pipeline
,
stage:
'build'
,
name:
'mac'
,
stage_idx:
0
,
status:
'failed'
)
create
(
:commit_status
,
pipeline:
pipeline
,
stage:
'deploy'
,
name:
'staging'
,
stage_idx:
2
,
status:
'running'
)
create
(
:commit_status
,
pipeline:
pipeline
,
stage:
'test'
,
name:
'rspec'
,
stage_idx:
1
,
status:
'success'
)
create
(
:commit_status
,
pipeline:
pipeline
,
stage:
'build'
,
name:
'linux'
,
stage_idx:
0
,
status:
'success'
)
create
(
:commit_status
,
pipeline:
pipeline
,
stage:
'build'
,
name:
'mac'
,
stage_idx:
0
,
status:
'failed'
)
create
(
:commit_status
,
pipeline:
pipeline
,
stage:
'deploy'
,
name:
'staging'
,
stage_idx:
2
,
status:
'running'
)
create
(
:commit_status
,
pipeline:
pipeline
,
stage:
'test'
,
name:
'rspec'
,
stage_idx:
1
,
status:
'success'
)
end
describe
'#stages'
do
subject
{
pipeline
.
stages
}
context
'stages list'
do
...
...
@@ -138,43 +158,48 @@ describe Ci::Pipeline, models: true do
end
end
it
'returns a valid number of stages'
do
expect
(
pipeline
.
stages_count
).
to
eq
(
3
)
end
it
'returns a valid names of stages'
do
expect
(
pipeline
.
stages_name
).
to
eq
([
'build'
,
'test'
,
'deploy'
])
end
context
'stages with statuses'
do
let
(
:statuses
)
do
subject
.
map
do
|
stage
|
[
stage
.
name
,
stage
.
status
]
end
subject
.
map
{
|
stage
|
[
stage
.
name
,
stage
.
status
]
}
end
it
'returns list of stages with
statuses'
do
it
'returns list of stages with correct
statuses'
do
expect
(
statuses
).
to
eq
([[
'build'
,
'failed'
],
[
'test'
,
'success'
],
[
'deploy'
,
'running'
]
])
[
'deploy'
,
'running'
]])
end
context
'when build
is retried'
do
context
'when commit status
is retried'
do
before
do
create
(
:commit_status
,
pipeline:
pipeline
,
stage:
'build'
,
name:
'mac'
,
stage_idx:
0
,
status:
'success'
)
create
(
:commit_status
,
pipeline:
pipeline
,
stage:
'build'
,
name:
'mac'
,
stage_idx:
0
,
status:
'success'
)
end
it
'ignores the previous state'
do
expect
(
statuses
).
to
eq
([[
'build'
,
'success'
],
[
'test'
,
'success'
],
[
'deploy'
,
'running'
]
])
[
'deploy'
,
'running'
]])
end
end
end
end
describe
'#stages_count'
do
it
'returns a valid number of stages'
do
expect
(
pipeline
.
stages_count
).
to
eq
(
3
)
end
end
describe
'#stages_name'
do
it
'returns a valid names of stages'
do
expect
(
pipeline
.
stages_name
).
to
eq
([
'build'
,
'test'
,
'deploy'
])
end
end
end
describe
'#stage'
do
subject
{
pipeline
.
stage
(
'test'
)
}
...
...
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