BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
9c49fa2d
Commit
9c49fa2d
authored
Nov 24, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for builds with no start date and spec
parent
afe90d52
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
1 deletion
+32
-1
entity_date_helper.rb
app/serializers/entity_date_helper.rb
+2
-0
analytics_build_entity_spec.rb
spec/serializers/analytics_build_entity_spec.rb
+30
-1
No files found.
app/serializers/entity_date_helper.rb
View file @
9c49fa2d
...
...
@@ -2,6 +2,8 @@ module EntityDateHelper
include
ActionView
::
Helpers
::
DateHelper
def
interval_in_words
(
diff
)
return
'not started'
unless
diff
"
#{
distance_of_time_in_words
(
Time
.
now
,
diff
)
}
ago"
end
...
...
spec/serializers/analytics_build_entity_spec.rb
View file @
9c49fa2d
...
...
@@ -7,7 +7,9 @@ describe AnalyticsBuildEntity do
context
'build with an author'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:build
)
{
create
(
:ci_build
,
author:
user
,
started_at:
2
.
hours
.
ago
,
finished_at:
1
.
hour
.
ago
)
}
let
(
:started_at
)
{
2
.
hours
.
ago
}
let
(
:finished_at
)
{
1
.
hour
.
ago
}
let
(
:build
)
{
create
(
:ci_build
,
author:
user
,
started_at:
started_at
,
finished_at:
finished_at
)
}
subject
{
entity
.
as_json
}
...
...
@@ -31,5 +33,32 @@ describe AnalyticsBuildEntity do
it
'contains the duration'
do
expect
(
subject
[
:total_time
]).
to
eq
(
hours:
1
)
end
context
'no started at or finished at date'
do
let
(
:started_at
)
{
nil
}
let
(
:finished_at
)
{
nil
}
it
'does not blow up'
do
expect
{
subject
[
:date
]
}.
not_to
raise_error
end
it
''
end
context
'no started at date'
do
let
(
:started_at
)
{
nil
}
it
'does not blow up'
do
expect
{
subject
[
:date
]
}.
not_to
raise_error
end
end
context
'no finished at date'
do
let
(
:finished_at
)
{
nil
}
it
'does not blow up'
do
expect
{
subject
[
:date
]
}.
not_to
raise_error
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