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
f91e8269
Commit
f91e8269
authored
Dec 12, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for build play extended detailed status
parent
ffafd097
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
3 deletions
+69
-3
spec/factories/ci/builds.rb
spec/factories/ci/builds.rb
+10
-3
spec/lib/gitlab/ci/status/build/play_spec.rb
spec/lib/gitlab/ci/status/build/play_spec.rb
+59
-0
No files found.
spec/factories/ci/builds.rb
View file @
f91e8269
...
@@ -12,12 +12,14 @@ FactoryGirl.define do
...
@@ -12,12 +12,14 @@ FactoryGirl.define do
started_at
'Di 29. Okt 09:51:28 CET 2013'
started_at
'Di 29. Okt 09:51:28 CET 2013'
finished_at
'Di 29. Okt 09:53:28 CET 2013'
finished_at
'Di 29. Okt 09:53:28 CET 2013'
commands
'ls -a'
commands
'ls -a'
options
do
options
do
{
{
image:
"ruby:2.1"
,
image:
"ruby:2.1"
,
services:
[
"postgres"
]
services:
[
"postgres"
]
}
}
end
end
yaml_variables
do
yaml_variables
do
[
[
{
key: :DB_NAME
,
value:
'postgres'
,
public:
true
}
{
key: :DB_NAME
,
value:
'postgres'
,
public:
true
}
...
@@ -60,15 +62,20 @@ FactoryGirl.define do
...
@@ -60,15 +62,20 @@ FactoryGirl.define do
end
end
trait
:teardown_environment
do
trait
:teardown_environment
do
options
do
environment
'staging'
{
environment:
{
action:
'stop'
}
}
options
environment:
{
name:
'staging'
,
end
action:
'stop'
}
end
end
trait
:allowed_to_fail
do
trait
:allowed_to_fail
do
allow_failure
true
allow_failure
true
end
end
trait
:playable
do
skipped
manual
end
after
(
:build
)
do
|
build
,
evaluator
|
after
(
:build
)
do
|
build
,
evaluator
|
build
.
project
=
build
.
pipeline
.
project
build
.
project
=
build
.
pipeline
.
project
end
end
...
...
spec/lib/gitlab/ci/status/build/play_spec.rb
0 → 100644
View file @
f91e8269
require
'spec_helper'
describe
Gitlab
::
Ci
::
Status
::
Build
::
Play
do
let
(
:core_status
)
{
double
(
'core status'
)
}
let
(
:user
)
{
double
(
'user'
)
}
subject
do
described_class
.
new
(
core_status
)
end
describe
'#text'
do
it
{
expect
(
subject
.
text
).
to
eq
'play'
}
end
describe
'#label'
do
it
{
expect
(
subject
.
label
).
to
eq
'play'
}
end
describe
'#icon'
do
it
'does not override core status icon'
do
expect
(
core_status
).
to
receive
(
:icon
)
subject
.
icon
end
end
describe
'.matches?'
do
context
'build is playable'
do
context
'when build stops an environment'
do
let
(
:build
)
do
create
(
:ci_build
,
:playable
,
:teardown_environment
)
end
it
'does not match'
do
expect
(
described_class
.
matches?
(
build
,
user
))
.
to
be
false
end
end
context
'when build does not stop an environment'
do
let
(
:build
)
{
create
(
:ci_build
,
:playable
)
}
it
'is a correct match'
do
expect
(
described_class
.
matches?
(
build
,
user
))
.
to
be
true
end
end
end
context
'when build is not playable'
do
let
(
:build
)
{
create
(
:ci_build
)
}
it
'does not match'
do
expect
(
described_class
.
matches?
(
build
,
user
))
.
to
be
false
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