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
0429ad80
Commit
0429ad80
authored
Sep 05, 2017
by
Jeff Stubler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor blame helper age class tests
parent
85c3128a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
22 deletions
+15
-22
spec/helpers/blame_helper_spec.rb
spec/helpers/blame_helper_spec.rb
+15
-22
No files found.
spec/helpers/blame_helper_spec.rb
View file @
0429ad80
...
...
@@ -35,39 +35,32 @@ describe BlameHelper do
end
describe
'#age_map_class'
do
let
(
:dates
)
do
[
Time
.
zone
.
local
(
2014
,
3
,
17
,
0
,
0
,
0
),
Time
.
zone
.
now
]
end
let
(
:blame_groups
)
do
[
{
commit:
double
(
committed_date:
dates
[
0
])
}
]
end
let
(
:today_blame_groups
)
do
[
{
commit:
double
(
committed_date:
dates
[
1
])
}
]
end
let
(
:date
)
{
Time
.
zone
.
local
(
2014
,
3
,
17
,
0
,
0
,
0
)
}
let
(
:blame_groups
)
{
[{
commit:
double
(
committed_date:
date
)
}]
}
let
(
:duration
)
do
project
=
double
(
created_at:
date
s
[
0
]
)
project
=
double
(
created_at:
date
)
helper
.
age_map_duration
(
blame_groups
,
project
)
end
let
(
:same_day_duration
)
do
project
=
double
(
created_at:
dates
[
1
])
helper
.
age_map_duration
(
today_blame_groups
,
project
)
end
it
'returns blame-commit-age-9 when oldest'
do
expect
(
helper
.
age_map_class
(
date
s
[
0
]
,
duration
)).
to
eq
'blame-commit-age-9'
expect
(
helper
.
age_map_class
(
date
,
duration
)).
to
eq
'blame-commit-age-9'
end
it
'returns blame-commit-age-0 class when newest'
do
expect
(
helper
.
age_map_class
(
duration
[
:now
],
duration
)).
to
eq
'blame-commit-age-0'
end
it
'returns blame-commit-age-0 class when created on same day'
do
puts
(
same_day_duration
.
inspect
)
context
'when called on the same day as project creation'
do
let
(
:same_day_duration
)
do
project
=
double
(
created_at:
now
)
helper
.
age_map_duration
(
today_blame_groups
,
project
)
end
let
(
:today_blame_groups
)
{
[{
commit:
double
(
committed_date:
now
)
}]
}
let
(
:now
)
{
Time
.
zone
.
now
}
it
'returns blame-commit-age-0 class'
do
expect
(
helper
.
age_map_class
(
duration
[
:now
],
same_day_duration
)).
to
eq
'blame-commit-age-0'
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