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
4f2cc595
Commit
4f2cc595
authored
May 01, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend action tooltop to show info about abilities
parent
6baaa8a9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
31 deletions
+42
-31
lib/gitlab/ci/status/build/play.rb
lib/gitlab/ci/status/build/play.rb
+5
-1
spec/lib/gitlab/ci/status/build/factory_spec.rb
spec/lib/gitlab/ci/status/build/factory_spec.rb
+1
-1
spec/lib/gitlab/ci/status/build/play_spec.rb
spec/lib/gitlab/ci/status/build/play_spec.rb
+36
-29
No files found.
lib/gitlab/ci/status/build/play.rb
View file @
4f2cc595
...
@@ -6,7 +6,11 @@ module Gitlab
...
@@ -6,7 +6,11 @@ module Gitlab
include
Status
::
Extended
include
Status
::
Extended
def
label
def
label
'manual play action'
if
has_action?
'manual play action'
else
'manual play action (not allowed)'
end
end
end
def
has_action?
def
has_action?
...
...
spec/lib/gitlab/ci/status/build/factory_spec.rb
View file @
4f2cc595
...
@@ -216,7 +216,7 @@ describe Gitlab::Ci::Status::Build::Factory do
...
@@ -216,7 +216,7 @@ describe Gitlab::Ci::Status::Build::Factory do
expect
(
status
.
group
).
to
eq
'manual'
expect
(
status
.
group
).
to
eq
'manual'
expect
(
status
.
icon
).
to
eq
'icon_status_manual'
expect
(
status
.
icon
).
to
eq
'icon_status_manual'
expect
(
status
.
favicon
).
to
eq
'favicon_status_manual'
expect
(
status
.
favicon
).
to
eq
'favicon_status_manual'
expect
(
status
.
label
).
to
eq
'manual play action'
expect
(
status
.
label
).
to
include
'manual play action'
expect
(
status
).
to
have_details
expect
(
status
).
to
have_details
expect
(
status
.
action_path
).
to
include
'play'
expect
(
status
.
action_path
).
to
include
'play'
end
end
...
...
spec/lib/gitlab/ci/status/build/play_spec.rb
View file @
4f2cc595
require
'spec_helper'
require
'spec_helper'
describe
Gitlab
::
Ci
::
Status
::
Build
::
Play
do
describe
Gitlab
::
Ci
::
Status
::
Build
::
Play
do
let
(
:status
)
{
double
(
'core'
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
double
(
'user'
)
}
let
(
:build
)
{
create
(
:ci_build
,
:manual
)
}
let
(
:status
)
{
Gitlab
::
Ci
::
Status
::
Core
.
new
(
build
,
user
)
}
subject
{
described_class
.
new
(
status
)
}
subject
{
described_class
.
new
(
status
)
}
describe
'#label'
do
context
'when user is allowed to update build'
do
it
{
expect
(
subject
.
label
).
to
eq
'manual play action'
}
context
'when user can push to branch'
do
end
before
{
build
.
project
.
add_master
(
user
)
}
describe
'action details'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:build
)
{
create
(
:ci_build
,
:manual
)
}
let
(
:status
)
{
Gitlab
::
Ci
::
Status
::
Core
.
new
(
build
,
user
)
}
describe
'#has_action?'
do
describe
'#has_action?'
do
context
'when user is allowed to update build'
do
it
{
is_expected
.
to
have_action
}
context
'when user can push to branch'
do
end
before
{
build
.
project
.
add_master
(
user
)
}
it
{
is_expected
.
to
have_action
}
describe
'#label'
do
it
'has a label that says it is a manual action'
do
expect
(
subject
.
label
).
to
eq
'manual play action'
end
end
end
end
context
'when user can not push to the branch'
do
context
'when user can not push to the branch'
do
before
{
build
.
project
.
add_developer
(
user
)
}
before
{
build
.
project
.
add_developer
(
user
)
}
it
{
is_expected
.
not_to
have_action
}
describe
'has_action?'
do
end
it
{
is_expected
.
not_to
have_action
}
end
end
context
'when user is not allowed to update build'
do
describe
'#label'
do
it
{
is_expected
.
not_to
have_action
}
it
'has a label that says user is not allowed to play it'
do
expect
(
subject
.
label
).
to
eq
'manual play action (not allowed)'
end
end
end
end
end
end
describe
'#action_path'
do
context
'when user is not allowed to update build'
do
it
{
expect
(
subject
.
action_path
).
to
include
"
#{
build
.
id
}
/play"
}
describe
'#has_action?'
do
it
{
is_expected
.
not_to
have_action
}
end
end
end
describe
'#action_icon
'
do
describe
'#action_path
'
do
it
{
expect
(
subject
.
action_icon
).
to
eq
'icon_action_play'
}
it
{
expect
(
subject
.
action_path
).
to
include
"
#{
build
.
id
}
/play"
}
end
end
describe
'#action_title'
do
describe
'#action_icon'
do
it
{
expect
(
subject
.
action_title
).
to
eq
'Play'
}
it
{
expect
(
subject
.
action_icon
).
to
eq
'icon_action_play'
}
end
end
describe
'#action_title'
do
it
{
expect
(
subject
.
action_title
).
to
eq
'Play'
}
end
end
describe
'.matches?'
do
describe
'.matches?'
do
...
...
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