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
571a934f
Commit
571a934f
authored
Sep 24, 2018
by
Shinya Maeda
Committed by
Alessio Caiazza
Oct 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix spec. Create scheduled status entry for pipeline
parent
f8e680b7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
27 deletions
+34
-27
app/models/concerns/has_status.rb
app/models/concerns/has_status.rb
+1
-1
lib/gitlab/ci/status/pipeline/factory.rb
lib/gitlab/ci/status/pipeline/factory.rb
+1
-0
lib/gitlab/ci/status/pipeline/scheduled.rb
lib/gitlab/ci/status/pipeline/scheduled.rb
+21
-0
spec/lib/gitlab/ci/status/pipeline/factory_spec.rb
spec/lib/gitlab/ci/status/pipeline/factory_spec.rb
+10
-25
spec/models/concerns/has_status_spec.rb
spec/models/concerns/has_status_spec.rb
+1
-1
No files found.
app/models/concerns/has_status.rb
View file @
571a934f
...
...
@@ -114,7 +114,7 @@ module HasStatus
end
def
blocked?
BLOCKED_STATUS
==
status
BLOCKED_STATUS
.
include?
(
status
)
end
private
...
...
lib/gitlab/ci/status/pipeline/factory.rb
View file @
571a934f
...
...
@@ -5,6 +5,7 @@ module Gitlab
class
Factory
<
Status
::
Factory
def
self
.
extended_statuses
[[
Status
::
SuccessWarning
,
Status
::
Pipeline
::
Scheduled
,
Status
::
Pipeline
::
Blocked
]]
end
...
...
lib/gitlab/ci/status/pipeline/scheduled.rb
0 → 100644
View file @
571a934f
module
Gitlab
module
Ci
module
Status
module
Pipeline
class
Scheduled
<
Status
::
Extended
def
text
s_
(
'CiStatusText|scheduled'
)
end
def
label
s_
(
'CiStatusLabel|waiting for scheduled job'
)
end
def
self
.
matches?
(
pipeline
,
user
)
pipeline
.
scheduled?
end
end
end
end
end
end
spec/lib/gitlab/ci/status/pipeline/factory_spec.rb
View file @
571a934f
...
...
@@ -11,8 +11,7 @@ describe Gitlab::Ci::Status::Pipeline::Factory do
end
context
'when pipeline has a core status'
do
(
HasStatus
::
AVAILABLE_STATUSES
-
[
HasStatus
::
BLOCKED_STATUS
])
.
each
do
|
simple_status
|
HasStatus
::
AVAILABLE_STATUSES
.
each
do
|
simple_status
|
context
"when core status is
#{
simple_status
}
"
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
status:
simple_status
)
}
...
...
@@ -24,8 +23,15 @@ describe Gitlab::Ci::Status::Pipeline::Factory do
expect
(
factory
.
core_status
).
to
be_a
expected_status
end
it
'does not match extended statuses'
do
expect
(
factory
.
extended_statuses
).
to
be_empty
if
HasStatus
::
BLOCKED_STATUS
.
include?
(
simple_status
)
it
'matches a correct extended statuses'
do
expect
(
factory
.
extended_statuses
)
.
to
eq
[
Gitlab
::
Ci
::
Status
::
Pipeline
::
Blocked
]
end
else
it
'does not match extended statuses'
do
expect
(
factory
.
extended_statuses
).
to
be_empty
end
end
it
"fabricates a core status
#{
simple_status
}
"
do
...
...
@@ -40,27 +46,6 @@ describe Gitlab::Ci::Status::Pipeline::Factory do
end
end
end
context
"when core status is manual"
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
status: :manual
)
}
it
"matches manual core status"
do
expect
(
factory
.
core_status
)
.
to
be_a
Gitlab
::
Ci
::
Status
::
Manual
end
it
'matches a correct extended statuses'
do
expect
(
factory
.
extended_statuses
)
.
to
eq
[
Gitlab
::
Ci
::
Status
::
Pipeline
::
Blocked
]
end
it
'extends core status with common pipeline methods'
do
expect
(
status
).
to
have_details
expect
(
status
).
not_to
have_action
expect
(
status
.
details_path
)
.
to
include
"pipelines/
#{
pipeline
.
id
}
"
end
end
end
context
'when pipeline has warnings'
do
...
...
spec/models/concerns/has_status_spec.rb
View file @
571a934f
...
...
@@ -300,7 +300,7 @@ describe HasStatus do
describe
'::BLOCKED_STATUS'
do
it
'is a status manual'
do
expect
(
described_class
::
BLOCKED_STATUS
).
to
eq
'manual'
expect
(
described_class
::
BLOCKED_STATUS
).
to
eq
%w[manual scheduled]
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