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
Léo-Paul Géneau
gitlab-ce
Commits
76f7cf92
Commit
76f7cf92
authored
Mar 17, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix time-sensitive helper spec
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
1ac6bb55
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
spec/helpers/milestones_helper_spec.rb
spec/helpers/milestones_helper_spec.rb
+10
-6
No files found.
spec/helpers/milestones_helper_spec.rb
View file @
76f7cf92
...
@@ -49,8 +49,12 @@ describe MilestonesHelper do
...
@@ -49,8 +49,12 @@ describe MilestonesHelper do
end
end
describe
'#milestone_remaining_days'
do
describe
'#milestone_remaining_days'
do
around
do
|
example
|
Timecop
.
freeze
(
Time
.
utc
(
2017
,
3
,
17
))
{
example
.
run
}
end
context
'when less than 31 days remaining'
do
context
'when less than 31 days remaining'
do
let
(
:milestone_remaining
)
{
milestone_remaining_days
(
build_stubbed
(
:milestone
,
due_date:
12.
2
.
days
.
from_now
))
}
let
(
:milestone_remaining
)
{
milestone_remaining_days
(
build_stubbed
(
:milestone
,
due_date:
12
.
days
.
from_now
.
utc
))
}
it
'returns days remaining'
do
it
'returns days remaining'
do
expect
(
milestone_remaining
).
to
eq
(
"<strong>12</strong> days remaining"
)
expect
(
milestone_remaining
).
to
eq
(
"<strong>12</strong> days remaining"
)
...
@@ -58,7 +62,7 @@ describe MilestonesHelper do
...
@@ -58,7 +62,7 @@ describe MilestonesHelper do
end
end
context
'when less than 1 year and more than 30 days remaining'
do
context
'when less than 1 year and more than 30 days remaining'
do
let
(
:milestone_remaining
)
{
milestone_remaining_days
(
build_stubbed
(
:milestone
,
due_date:
2
.
months
.
from_now
))
}
let
(
:milestone_remaining
)
{
milestone_remaining_days
(
build_stubbed
(
:milestone
,
due_date:
2
.
months
.
from_now
.
utc
))
}
it
'returns months remaining'
do
it
'returns months remaining'
do
expect
(
milestone_remaining
).
to
eq
(
"<strong>2</strong> months remaining"
)
expect
(
milestone_remaining
).
to
eq
(
"<strong>2</strong> months remaining"
)
...
@@ -66,7 +70,7 @@ describe MilestonesHelper do
...
@@ -66,7 +70,7 @@ describe MilestonesHelper do
end
end
context
'when more than 1 year remaining'
do
context
'when more than 1 year remaining'
do
let
(
:milestone_remaining
)
{
milestone_remaining_days
(
build_stubbed
(
:milestone
,
due_date:
1
.
year
.
from_now
+
2
.
days
))
}
let
(
:milestone_remaining
)
{
milestone_remaining_days
(
build_stubbed
(
:milestone
,
due_date:
(
1
.
year
.
from_now
+
2
.
days
).
utc
))
}
it
'returns years remaining'
do
it
'returns years remaining'
do
expect
(
milestone_remaining
).
to
eq
(
"<strong>1</strong> year remaining"
)
expect
(
milestone_remaining
).
to
eq
(
"<strong>1</strong> year remaining"
)
...
@@ -74,7 +78,7 @@ describe MilestonesHelper do
...
@@ -74,7 +78,7 @@ describe MilestonesHelper do
end
end
context
'when milestone is expired'
do
context
'when milestone is expired'
do
let
(
:milestone_remaining
)
{
milestone_remaining_days
(
build_stubbed
(
:milestone
,
due_date:
2
.
days
.
ago
))
}
let
(
:milestone_remaining
)
{
milestone_remaining_days
(
build_stubbed
(
:milestone
,
due_date:
2
.
days
.
ago
.
utc
))
}
it
'returns "Past due"'
do
it
'returns "Past due"'
do
expect
(
milestone_remaining
).
to
eq
(
"<strong>Past due</strong>"
)
expect
(
milestone_remaining
).
to
eq
(
"<strong>Past due</strong>"
)
...
@@ -82,7 +86,7 @@ describe MilestonesHelper do
...
@@ -82,7 +86,7 @@ describe MilestonesHelper do
end
end
context
'when milestone has start_date in the future'
do
context
'when milestone has start_date in the future'
do
let
(
:milestone_remaining
)
{
milestone_remaining_days
(
build_stubbed
(
:milestone
,
start_date:
2
.
days
.
from_now
))
}
let
(
:milestone_remaining
)
{
milestone_remaining_days
(
build_stubbed
(
:milestone
,
start_date:
2
.
days
.
from_now
.
utc
))
}
it
'returns "Upcoming"'
do
it
'returns "Upcoming"'
do
expect
(
milestone_remaining
).
to
eq
(
"<strong>Upcoming</strong>"
)
expect
(
milestone_remaining
).
to
eq
(
"<strong>Upcoming</strong>"
)
...
@@ -90,7 +94,7 @@ describe MilestonesHelper do
...
@@ -90,7 +94,7 @@ describe MilestonesHelper do
end
end
context
'when milestone has start_date in the past'
do
context
'when milestone has start_date in the past'
do
let
(
:milestone_remaining
)
{
milestone_remaining_days
(
build_stubbed
(
:milestone
,
start_date:
2
.
days
.
ago
))
}
let
(
:milestone_remaining
)
{
milestone_remaining_days
(
build_stubbed
(
:milestone
,
start_date:
2
.
days
.
ago
.
utc
))
}
it
'returns days elapsed'
do
it
'returns days elapsed'
do
expect
(
milestone_remaining
).
to
eq
(
"<strong>2</strong> days elapsed"
)
expect
(
milestone_remaining
).
to
eq
(
"<strong>2</strong> days elapsed"
)
...
...
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