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
ec586042
Commit
ec586042
authored
Apr 21, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix lastest commit status text on main project page
parent
ff986c70
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
11 deletions
+65
-11
app/helpers/ci_status_helper.rb
app/helpers/ci_status_helper.rb
+17
-0
app/views/projects/_last_commit.html.haml
app/views/projects/_last_commit.html.haml
+1
-2
spec/views/projects/_last_commit.html.haml_spec.rb
spec/views/projects/_last_commit.html.haml_spec.rb
+22
-0
spec/views/projects/commit/_commit_box.html.haml_spec.rb
spec/views/projects/commit/_commit_box.html.haml_spec.rb
+25
-9
No files found.
app/helpers/ci_status_helper.rb
View file @
ec586042
...
...
@@ -22,6 +22,23 @@ module CiStatusHelper
end
end
def
ci_text_for_status
(
status
)
if
detailed_status?
(
status
)
return
status
.
text
end
case
status
when
'success'
'passed'
when
'success_with_warnings'
'passed'
when
'manual'
'blocked'
else
status
end
end
def
ci_status_for_statuseable
(
subject
)
status
=
subject
.
try
(
:status
)
||
'not found'
status
.
humanize
...
...
app/views/projects/_last_commit.html.haml
View file @
ec586042
-
ref
=
local_assigns
.
fetch
(
:ref
)
-
status
=
commit
.
status
(
ref
)
-
if
status
=
link_to
pipelines_namespace_project_commit_path
(
commit
.
project
.
namespace
,
commit
.
project
,
commit
),
class:
"ci-status ci-
#{
status
}
"
do
=
ci_icon_for_status
(
status
)
=
ci_
label
_for_status
(
status
)
=
ci_
text
_for_status
(
status
)
=
link_to
commit
.
short_id
,
namespace_project_commit_path
(
project
.
namespace
,
project
,
commit
),
class:
"commit_short_id"
=
link_to_gfm
commit
.
title
,
namespace_project_commit_path
(
project
.
namespace
,
project
,
commit
),
class:
"commit-row-message"
...
...
spec/views/projects/_last_commit.html.haml_spec.rb
0 → 100644
View file @
ec586042
require
'spec_helper'
describe
'projects/_last_commit'
,
:view
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
context
'when there is a pipeline present for the commit'
do
context
'when pipeline is blocked'
do
let!
(
:pipeline
)
do
create
(
:ci_pipeline
,
:blocked
,
project:
project
,
sha:
project
.
commit
.
id
)
end
it
'shows correct pipeline badge'
do
render
'projects/last_commit'
,
commit:
project
.
commit
,
project:
project
,
ref: :master
expect
(
rendered
).
to
have_text
"blocked
#{
project
.
commit
.
short_id
}
"
end
end
end
end
spec/views/projects/commit/_commit_box.html.haml_spec.rb
View file @
ec586042
require
'spec_helper'
describe
'projects/commit/_commit_box.html.haml'
do
include
Devise
::
Test
::
ControllerHelpers
describe
'projects/commit/_commit_box.html.haml'
,
:view
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
...
...
@@ -18,7 +16,9 @@ describe 'projects/commit/_commit_box.html.haml' do
expect
(
rendered
).
to
have_text
(
"
#{
Commit
.
truncate_sha
(
project
.
commit
.
sha
)
}
"
)
end
it
'shows the last pipeline that ran for the commit'
do
context
'when there is a pipeline present'
do
context
'when there are multiple pipelines for a commit'
do
it
'shows the last pipeline'
do
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
,
status:
'success'
)
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
,
status:
'canceled'
)
third_pipeline
=
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
,
status:
'failed'
)
...
...
@@ -27,6 +27,22 @@ describe 'projects/commit/_commit_box.html.haml' do
expect
(
rendered
).
to
have_text
(
"Pipeline #
#{
third_pipeline
.
id
}
failed"
)
end
end
context
'when pipeline for the commit is blocked'
do
let!
(
:pipeline
)
do
create
(
:ci_pipeline
,
:blocked
,
project:
project
,
sha:
project
.
commit
.
id
)
end
it
'shows correct pipeline description'
do
render
expect
(
rendered
).
to
have_text
"Pipeline #
#{
pipeline
.
id
}
"
\
'waiting for manual action'
end
end
end
context
'viewing a commit'
do
context
'as a developer'
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