2019-07-25 05:24:42 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-05-25 19:32:37 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-07-05 06:32:05 +00:00
|
|
|
describe 'Tooltips on .timeago dates', :js do
|
2016-05-25 19:32:37 +00:00
|
|
|
let(:user) { create(:user) }
|
2017-08-02 19:55:11 +00:00
|
|
|
let(:project) { create(:project, name: 'test', namespace: user.namespace) }
|
2016-05-25 19:32:37 +00:00
|
|
|
let(:created_date) { Date.yesterday.to_time }
|
2017-06-15 12:29:11 +00:00
|
|
|
let(:expected_format) { created_date.in_time_zone.strftime('%b %-d, %Y %l:%M%P') }
|
2016-05-25 19:32:37 +00:00
|
|
|
|
|
|
|
context 'on the activity tab' do
|
|
|
|
before do
|
2018-07-11 14:36:08 +00:00
|
|
|
project.add_maintainer(user)
|
2016-05-25 19:32:37 +00:00
|
|
|
|
|
|
|
Event.create( project: project, author_id: user.id, action: Event::JOINED,
|
|
|
|
updated_at: created_date, created_at: created_date)
|
|
|
|
|
2017-06-21 23:44:10 +00:00
|
|
|
sign_in user
|
2018-10-04 07:55:37 +00:00
|
|
|
visit user_activity_path(user)
|
2019-01-24 13:43:02 +00:00
|
|
|
wait_for_requests
|
2016-05-25 19:32:37 +00:00
|
|
|
|
|
|
|
page.find('.js-timeago').hover
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'has the datetime formated correctly' do
|
|
|
|
expect(page).to have_selector('.local-timeago', text: expected_format)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'on the snippets tab' do
|
|
|
|
before do
|
2018-07-11 14:36:08 +00:00
|
|
|
project.add_maintainer(user)
|
2016-05-25 19:32:37 +00:00
|
|
|
create(:snippet, author: user, updated_at: created_date, created_at: created_date)
|
|
|
|
|
2017-06-21 23:44:10 +00:00
|
|
|
sign_in user
|
2016-05-25 19:32:37 +00:00
|
|
|
visit user_snippets_path(user)
|
2019-01-24 13:43:02 +00:00
|
|
|
wait_for_requests
|
2016-05-25 19:32:37 +00:00
|
|
|
|
2016-12-08 22:13:23 +00:00
|
|
|
page.find('.js-timeago.snippet-created-ago').hover
|
2016-05-25 19:32:37 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'has the datetime formated correctly' do
|
|
|
|
expect(page).to have_selector('.local-timeago', text: expected_format)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|