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
5f3c1a54
Commit
5f3c1a54
authored
Oct 03, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec for Gitlab::Ci::Status::Build::Unschedule
parent
64d1eabf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
94 additions
and
0 deletions
+94
-0
spec/lib/gitlab/ci/status/build/unschedule_spec.rb
spec/lib/gitlab/ci/status/build/unschedule_spec.rb
+94
-0
No files found.
spec/lib/gitlab/ci/status/build/unschedule_spec.rb
0 → 100644
View file @
5f3c1a54
require
'spec_helper'
describe
Gitlab
::
Ci
::
Status
::
Build
::
Unschedule
do
let
(
:status
)
{
double
(
'core status'
)
}
let
(
:user
)
{
double
(
'user'
)
}
subject
do
described_class
.
new
(
status
)
end
describe
'#label'
do
it
{
expect
(
subject
.
label
).
to
eq
'unschedule action'
}
end
describe
'action details'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:build
)
{
create
(
:ci_build
)
}
let
(
:status
)
{
Gitlab
::
Ci
::
Status
::
Core
.
new
(
build
,
user
)
}
describe
'#has_action?'
do
context
'when user is allowed to update build'
do
before
do
stub_not_protect_default_branch
build
.
project
.
add_developer
(
user
)
end
it
{
is_expected
.
to
have_action
}
end
context
'when user is not allowed to update build'
do
it
{
is_expected
.
not_to
have_action
}
end
end
describe
'#action_path'
do
it
{
expect
(
subject
.
action_path
).
to
include
"
#{
build
.
id
}
/unschedule"
}
end
describe
'#action_icon'
do
it
{
expect
(
subject
.
action_icon
).
to
eq
'time-out'
}
end
describe
'#action_title'
do
it
{
expect
(
subject
.
action_title
).
to
eq
'Unschedule'
}
end
describe
'#action_button_title'
do
it
{
expect
(
subject
.
action_button_title
).
to
eq
'Unschedule job'
}
end
end
describe
'.matches?'
do
subject
{
described_class
.
matches?
(
build
,
user
)
}
context
'when build is scheduled'
do
context
'when build unschedules an delayed job'
do
let
(
:build
)
{
create
(
:ci_build
,
:scheduled
)
}
it
'is a correct match'
do
expect
(
subject
).
to
be
true
end
end
context
'when build unschedules an normal job'
do
let
(
:build
)
{
create
(
:ci_build
)
}
it
'does not match'
do
expect
(
subject
).
to
be
false
end
end
end
end
describe
'#status_tooltip'
do
it
'does not override status status_tooltip'
do
expect
(
status
).
to
receive
(
:status_tooltip
)
subject
.
status_tooltip
end
end
describe
'#badge_tooltip'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:build
)
{
create
(
:ci_build
,
:playable
)
}
let
(
:status
)
{
Gitlab
::
Ci
::
Status
::
Core
.
new
(
build
,
user
)
}
it
'does not override status badge_tooltip'
do
expect
(
status
).
to
receive
(
:badge_tooltip
)
subject
.
badge_tooltip
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