2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-06-16 23:09:34 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
describe 'Tooltips on .timeago dates', :js do
|
2016-06-16 23:09:34 +05:30
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project, name: 'test', namespace: user.namespace) }
|
|
|
|
let(:created_date) { Date.yesterday.to_time }
|
2017-09-10 17:25:29 +05:30
|
|
|
let(:expected_format) { created_date.in_time_zone.strftime('%b %-d, %Y %l:%M%P') }
|
2016-06-16 23:09:34 +05:30
|
|
|
|
|
|
|
context 'on the activity tab' do
|
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2016-06-16 23:09:34 +05:30
|
|
|
|
|
|
|
Event.create( project: project, author_id: user.id, action: Event::JOINED,
|
|
|
|
updated_at: created_date, created_at: created_date)
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in user
|
2018-12-05 23:21:45 +05:30
|
|
|
visit user_activity_path(user)
|
2019-03-02 22:35:43 +05:30
|
|
|
wait_for_requests
|
2016-06-16 23:09:34 +05:30
|
|
|
|
|
|
|
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-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2016-06-16 23:09:34 +05:30
|
|
|
create(:snippet, author: user, updated_at: created_date, created_at: created_date)
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in user
|
2016-06-16 23:09:34 +05:30
|
|
|
visit user_snippets_path(user)
|
2019-03-02 22:35:43 +05:30
|
|
|
wait_for_requests
|
2016-06-16 23:09:34 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
page.find('.js-timeago.snippet-created-ago').hover
|
2016-06-16 23:09:34 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'has the datetime formated correctly' do
|
|
|
|
expect(page).to have_selector('.local-timeago', text: expected_format)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|