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
9fc41f1e
Commit
9fc41f1e
authored
Sep 09, 2020
by
Albert Salim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix timezone dependency in time format
parent
2ed92862
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
13 deletions
+22
-13
spec/features/dashboard/datetime_on_tooltips_spec.rb
spec/features/dashboard/datetime_on_tooltips_spec.rb
+22
-13
No files found.
spec/features/dashboard/datetime_on_tooltips_spec.rb
View file @
9fc41f1e
...
...
@@ -3,44 +3,53 @@
require
'spec_helper'
RSpec
.
describe
'Tooltips on .timeago dates'
,
:js
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
name:
'test'
,
namespace:
user
.
namespace
)
}
let
(
:created_date
)
{
Date
.
yesterday
.
to_time
}
let
(
:expected_format
)
{
created_date
.
in_time_zone
.
strftime
(
'%b %-d, %Y %l:%M%P'
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
,
name:
'test'
,
namespace:
user
.
namespace
)
}
let
(
:created_date
)
{
1
.
day
.
ago
.
beginning_of_minute
-
1
.
hour
}
before_all
do
project
.
add_maintainer
(
user
)
end
context
'on the activity tab'
do
before
do
project
.
add_maintainer
(
user
)
Event
.
create
(
project:
project
,
author_id:
user
.
id
,
action: :joined
,
updated_at:
created_date
,
created_at:
created_date
)
sign_in
user
visit
user_activity_path
(
user
)
wait_for_requests
page
.
find
(
'.js-timeago'
).
hover
end
it
'has the datetime formated correctly'
do
expect
(
page
).
to
have_selector
(
'.local-timeago'
,
text:
expected_format
)
expect
(
page
).
to
have_selector
(
'.js-timeago'
,
text:
'1 day ago'
)
page
.
find
(
'.js-timeago'
).
hover
expect
(
datetime_in_tooltip
).
to
eq
(
created_date
)
end
end
context
'on the snippets tab'
do
before
do
project
.
add_maintainer
(
user
)
create
(
:snippet
,
author:
user
,
updated_at:
created_date
,
created_at:
created_date
)
sign_in
user
visit
user_snippets_path
(
user
)
wait_for_requests
page
.
find
(
'.js-timeago.snippet-created-ago'
).
hover
end
it
'has the datetime formated correctly'
do
expect
(
page
).
to
have_selector
(
'.local-timeago'
,
text:
expected_format
)
expect
(
page
).
to
have_selector
(
'.js-timeago.snippet-created-ago'
,
text:
'1 day ago'
)
page
.
find
(
'.js-timeago.snippet-created-ago'
).
hover
expect
(
datetime_in_tooltip
).
to
eq
(
created_date
)
end
end
def
datetime_in_tooltip
datetime_text
=
page
.
find
(
'.local-timeago'
).
text
DateTime
.
parse
(
datetime_text
)
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