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
Boxiang Sun
gitlab-ce
Commits
48d43608
Commit
48d43608
authored
Dec 13, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refine build stop/play extended status specs
parent
2011f8f1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
35 deletions
+35
-35
lib/gitlab/ci/status/build/play.rb
lib/gitlab/ci/status/build/play.rb
+4
-4
spec/lib/gitlab/ci/status/build/play_spec.rb
spec/lib/gitlab/ci/status/build/play_spec.rb
+10
-17
spec/lib/gitlab/ci/status/build/stop_spec.rb
spec/lib/gitlab/ci/status/build/stop_spec.rb
+21
-14
No files found.
lib/gitlab/ci/status/build/play.rb
View file @
48d43608
...
@@ -21,14 +21,14 @@ module Gitlab
...
@@ -21,14 +21,14 @@ module Gitlab
can?
(
user
,
:update_build
,
subject
)
can?
(
user
,
:update_build
,
subject
)
end
end
def
action_title
'Play'
end
def
action_icon
def
action_icon
'play'
'play'
end
end
def
action_title
'Play'
end
def
action_class
def
action_class
'ci-play-icon'
'ci-play-icon'
end
end
...
...
spec/lib/gitlab/ci/status/build/play_spec.rb
View file @
48d43608
require
'spec_helper'
require
'spec_helper'
describe
Gitlab
::
Ci
::
Status
::
Build
::
Play
do
describe
Gitlab
::
Ci
::
Status
::
Build
::
Play
do
let
(
:
core_status
)
{
double
(
'core status
'
)
}
let
(
:
status
)
{
double
(
'core
'
)
}
let
(
:user
)
{
double
(
'user'
)
}
let
(
:user
)
{
double
(
'user'
)
}
subject
do
subject
{
described_class
.
new
(
status
)
}
described_class
.
new
(
core_status
)
end
describe
'#text'
do
describe
'#text'
do
it
{
expect
(
subject
.
text
).
to
eq
'
play
'
}
it
{
expect
(
subject
.
text
).
to
eq
'
manual
'
}
end
end
describe
'#label'
do
describe
'#label'
do
it
{
expect
(
subject
.
label
).
to
eq
'
play
'
}
it
{
expect
(
subject
.
label
).
to
eq
'
manual play action
'
}
end
end
describe
'#icon'
do
describe
'#icon'
do
it
'does not override core status icon'
do
it
{
expect
(
subject
.
icon
).
to
eq
'icon_status_manual'
}
expect
(
core_status
).
to
receive
(
:icon
)
subject
.
icon
end
end
end
describe
'.matches?'
do
describe
'.matches?'
do
subject
{
described_class
.
matches?
(
build
,
user
)
}
context
'build is playable'
do
context
'build is playable'
do
context
'when build stops an environment'
do
context
'when build stops an environment'
do
let
(
:build
)
do
let
(
:build
)
do
...
@@ -32,8 +28,7 @@ describe Gitlab::Ci::Status::Build::Play do
...
@@ -32,8 +28,7 @@ describe Gitlab::Ci::Status::Build::Play do
end
end
it
'does not match'
do
it
'does not match'
do
expect
(
described_class
.
matches?
(
build
,
user
))
expect
(
subject
).
to
be
false
.
to
be
false
end
end
end
end
...
@@ -41,8 +36,7 @@ describe Gitlab::Ci::Status::Build::Play do
...
@@ -41,8 +36,7 @@ describe Gitlab::Ci::Status::Build::Play do
let
(
:build
)
{
create
(
:ci_build
,
:playable
)
}
let
(
:build
)
{
create
(
:ci_build
,
:playable
)
}
it
'is a correct match'
do
it
'is a correct match'
do
expect
(
described_class
.
matches?
(
build
,
user
))
expect
(
subject
).
to
be
true
.
to
be
true
end
end
end
end
end
end
...
@@ -51,8 +45,7 @@ describe Gitlab::Ci::Status::Build::Play do
...
@@ -51,8 +45,7 @@ describe Gitlab::Ci::Status::Build::Play do
let
(
:build
)
{
create
(
:ci_build
)
}
let
(
:build
)
{
create
(
:ci_build
)
}
it
'does not match'
do
it
'does not match'
do
expect
(
described_class
.
matches?
(
build
,
user
))
expect
(
subject
).
to
be
false
.
to
be
false
end
end
end
end
end
end
...
...
spec/lib/gitlab/ci/status/build/stop_spec.rb
View file @
48d43608
require
'spec_helper'
require
'spec_helper'
describe
Gitlab
::
Ci
::
Status
::
Build
::
Stop
do
describe
Gitlab
::
Ci
::
Status
::
Build
::
Stop
do
let
(
:
core_
status
)
{
double
(
'core status'
)
}
let
(
:status
)
{
double
(
'core status'
)
}
let
(
:user
)
{
double
(
'user'
)
}
let
(
:user
)
{
double
(
'user'
)
}
subject
do
subject
do
described_class
.
new
(
core_
status
)
described_class
.
new
(
status
)
end
end
describe
'#text'
do
describe
'#text'
do
it
{
expect
(
subject
.
text
).
to
eq
'
stop
'
}
it
{
expect
(
subject
.
text
).
to
eq
'
manual
'
}
end
end
describe
'#label'
do
describe
'#label'
do
it
{
expect
(
subject
.
label
).
to
eq
'
stop
'
}
it
{
expect
(
subject
.
label
).
to
eq
'
manual stop action
'
}
end
end
describe
'#icon'
do
describe
'#icon'
do
it
'does not override core status icon'
do
it
{
expect
(
subject
.
icon
).
to
eq
'icon_status_manual'
}
expect
(
core_status
).
to
receive
(
:icon
)
end
subject
.
icon
describe
'#has_action?'
do
end
end
describe
'#action_icon'
do
end
describe
'#action_path'
do
end
describe
'#action_title'
do
end
end
describe
'.matches?'
do
describe
'.matches?'
do
subject
{
described_class
.
matches?
(
build
,
user
)
}
context
'build is playable'
do
context
'build is playable'
do
context
'when build stops an environment'
do
context
'when build stops an environment'
do
let
(
:build
)
do
let
(
:build
)
do
...
@@ -32,8 +42,7 @@ describe Gitlab::Ci::Status::Build::Stop do
...
@@ -32,8 +42,7 @@ describe Gitlab::Ci::Status::Build::Stop do
end
end
it
'is a correct match'
do
it
'is a correct match'
do
expect
(
described_class
.
matches?
(
build
,
user
))
expect
(
subject
).
to
be
true
.
to
be
true
end
end
end
end
...
@@ -41,8 +50,7 @@ describe Gitlab::Ci::Status::Build::Stop do
...
@@ -41,8 +50,7 @@ describe Gitlab::Ci::Status::Build::Stop do
let
(
:build
)
{
create
(
:ci_build
,
:playable
)
}
let
(
:build
)
{
create
(
:ci_build
,
:playable
)
}
it
'does not match'
do
it
'does not match'
do
expect
(
described_class
.
matches?
(
build
,
user
))
expect
(
subject
).
to
be
false
.
to
be
false
end
end
end
end
end
end
...
@@ -51,8 +59,7 @@ describe Gitlab::Ci::Status::Build::Stop do
...
@@ -51,8 +59,7 @@ describe Gitlab::Ci::Status::Build::Stop do
let
(
:build
)
{
create
(
:ci_build
)
}
let
(
:build
)
{
create
(
:ci_build
)
}
it
'does not match'
do
it
'does not match'
do
expect
(
described_class
.
matches?
(
build
,
user
))
expect
(
subject
).
to
be
false
.
to
be
false
end
end
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