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
Léo-Paul Géneau
gitlab-ce
Commits
7518330a
Commit
7518330a
authored
Apr 19, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor ci commit specs by adding context blocks
parent
bdb86ea6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
77 deletions
+85
-77
spec/models/ci/commit_spec.rb
spec/models/ci/commit_spec.rb
+85
-77
No files found.
spec/models/ci/commit_spec.rb
View file @
7518330a
...
...
@@ -158,97 +158,105 @@ describe Ci::Commit, models: true do
stub_ci_commit_yaml_file
(
YAML
.
dump
(
yaml
))
end
it
'properly creates builds'
do
expect
(
create_builds
).
to
be_truthy
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'success'
,
'pending'
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
,
'deploy'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
,
'deploy'
,
'cleanup'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'success'
,
'success'
,
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'success'
,
'success'
,
'success'
)
commit
.
reload
expect
(
commit
.
status
).
to
eq
(
'success'
)
context
'when builds are successful'
do
it
'properly creates builds'
do
expect
(
create_builds
).
to
be_truthy
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'success'
,
'pending'
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
,
'deploy'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
,
'deploy'
,
'cleanup'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'success'
,
'success'
,
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'success'
,
'success'
,
'success'
)
commit
.
reload
expect
(
commit
.
status
).
to
eq
(
'success'
)
end
end
it
'properly creates builds when test fails'
do
expect
(
create_builds
).
to
be_truthy
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:success
)
context
'when test job fails'
do
it
'properly creates builds'
do
expect
(
create_builds
).
to
be_truthy
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:drop
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:drop
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
,
'test_failure'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'failed'
,
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
,
'test_failure'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'failed'
,
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
,
'test_failure'
,
'cleanup'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'failed'
,
'success'
,
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
,
'test_failure'
,
'cleanup'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'failed'
,
'success'
,
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'failed'
,
'success'
,
'success'
)
commit
.
reload
expect
(
commit
.
status
).
to
eq
(
'failed'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'failed'
,
'success'
,
'success'
)
commit
.
reload
expect
(
commit
.
status
).
to
eq
(
'failed'
)
end
end
it
'properly creates builds when test and test_failure fails'
do
expect
(
create_builds
).
to
be_truthy
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:drop
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
,
'test_failure'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'failed'
,
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:drop
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
,
'test_failure'
,
'cleanup'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'failed'
,
'failed'
,
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
,
'test_failure'
,
'cleanup'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'failed'
,
'failed'
,
'success'
)
commit
.
reload
expect
(
commit
.
status
).
to
eq
(
'failed'
)
context
'when test and test_failure jobs fail'
do
it
'properly creates builds'
do
expect
(
create_builds
).
to
be_truthy
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:drop
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
,
'test_failure'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'failed'
,
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:drop
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
,
'test_failure'
,
'cleanup'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'failed'
,
'failed'
,
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
,
'test_failure'
,
'cleanup'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'failed'
,
'failed'
,
'success'
)
commit
.
reload
expect
(
commit
.
status
).
to
eq
(
'failed'
)
end
end
it
'properly creates builds when deploy fails'
do
expect
(
create_builds
).
to
be_truthy
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:success
)
context
'when deploy job fails'
do
it
'properly creates builds'
do
expect
(
create_builds
).
to
be_truthy
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
,
'deploy'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'success'
,
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:drop
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
,
'deploy'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'success'
,
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:drop
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
,
'deploy'
,
'cleanup'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'success'
,
'failed'
,
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
commit
.
builds
.
pluck
(
:name
)).
to
contain_exactly
(
'build'
,
'test'
,
'deploy'
,
'cleanup'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'success'
,
'failed'
,
'pending'
)
commit
.
builds
.
running_or_pending
.
each
(
&
:success
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'success'
,
'failed'
,
'success'
)
commit
.
reload
expect
(
commit
.
status
).
to
eq
(
'failed'
)
expect
(
commit
.
builds
.
pluck
(
:status
)).
to
contain_exactly
(
'success'
,
'success'
,
'failed'
,
'success'
)
commit
.
reload
expect
(
commit
.
status
).
to
eq
(
'failed'
)
end
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