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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
10499677
Commit
10499677
authored
Dec 05, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Stage tests
parent
d47aef58
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
1 deletion
+64
-1
app/models/ci/stage.rb
app/models/ci/stage.rb
+4
-0
lib/gitlab/ci/status/stage/factory.rb
lib/gitlab/ci/status/stage/factory.rb
+1
-1
spec/lib/gitlab/ci/status/stage/common_spec.rb
spec/lib/gitlab/ci/status/stage/common_spec.rb
+26
-0
spec/lib/gitlab/ci/status/stage/factory_spec.rb
spec/lib/gitlab/ci/status/stage/factory_spec.rb
+33
-0
No files found.
app/models/ci/stage.rb
View file @
10499677
...
...
@@ -20,6 +20,10 @@ module Ci
@status
||=
statuses
.
latest
.
status
end
def
detailed_status
Gitlab
::
Ci
::
Status
::
Stage
::
Factory
.
new
(
self
).
fabricate!
end
def
statuses
@statuses
||=
pipeline
.
statuses
.
where
(
stage:
stage
)
end
...
...
lib/gitlab/ci/status/stage/factory.rb
View file @
10499677
...
...
@@ -24,7 +24,7 @@ module Gitlab
Gitlab
::
Ci
::
Status
.
const_get
(
@status
.
capitalize
)
.
new
(
@stage
)
.
extend
(
Status
::
Pipelin
e
::
Common
)
.
extend
(
Status
::
Stag
e
::
Common
)
end
def
extended_status
...
...
spec/lib/gitlab/ci/status/stage/common_spec.rb
0 → 100644
View file @
10499677
require
'spec_helper'
describe
Gitlab
::
Ci
::
Status
::
Stage
::
Common
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
)
}
let
(
:stage
)
{
Ci
::
Stage
.
new
(
pipeline
,
'test'
)
}
subject
do
Class
.
new
(
Gitlab
::
Ci
::
Status
::
Core
)
.
new
(
pipeline
).
extend
(
described_class
)
end
it
'does not have action'
do
expect
(
subject
).
not_to
have_action
end
it
'has details'
do
expect
(
subject
).
to
have_details
end
it
'links to the pipeline details page'
do
expect
(
subject
.
details_path
)
.
to
include
"pipelines/
#{
pipeline
.
id
}
"
expect
(
subject
.
details_path
)
.
to
include
"#
#{
stage
.
name
}
"
end
end
spec/lib/gitlab/ci/status/stage/factory_spec.rb
0 → 100644
View file @
10499677
require
'spec_helper'
describe
Gitlab
::
Ci
::
Status
::
Stage
::
Factory
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
)
}
let
(
:stage
)
{
Ci
::
Stage
.
new
(
pipeline
,
'test'
)
}
subject
do
described_class
.
new
(
stage
)
end
let
(
:status
)
do
subject
.
fabricate!
end
context
'when stage has a core status'
do
HasStatus
::
AVAILABLE_STATUSES
.
each
do
|
core_status
|
context
"when core status is
#{
core_status
}
"
do
let
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
,
stage:
stage
.
name
,
status:
core_status
)
}
it
"fabricates a core status
#{
core_status
}
"
do
expect
(
status
).
to
be_a
(
Gitlab
::
Ci
::
Status
.
const_get
(
core_status
.
capitalize
))
end
it
'extends core status with common pipeline methods'
do
expect
(
status
).
to
have_details
expect
(
status
.
details_path
).
to
include
"pipelines/
#{
pipeline
.
id
}
"
expect
(
status
.
details_path
).
to
include
"#
#{
stage
.
name
}
"
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