gitlab-org--gitlab-foss/spec/features/dashboard/datetime_on_tooltips_spec.rb

45 lines
1.3 KiB
Ruby
Raw Normal View History

2016-05-25 15:32:37 -04:00
require 'spec_helper'
feature 'Tooltips on .timeago dates', js: true do
2016-05-25 15:32:37 -04:00
let(:user) { create(:user) }
let(:project) { create(:project, name: 'test', namespace: user.namespace) }
2016-05-25 15:32:37 -04:00
let(:created_date) { Date.yesterday.to_time }
let(:expected_format) { created_date.in_time_zone.strftime('%b %-d, %Y %l:%M%P') }
2016-05-25 15:32:37 -04:00
context 'on the activity tab' do
before do
project.team << [user, :master]
Event.create( project: project, author_id: user.id, action: Event::JOINED,
updated_at: created_date, created_at: created_date)
sign_in user
2016-05-25 15:32:37 -04:00
visit user_path(user)
wait_for_requests()
2016-05-25 15:32:37 -04: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
project.team << [user, :master]
create(:snippet, author: user, updated_at: created_date, created_at: created_date)
sign_in user
2016-05-25 15:32:37 -04:00
visit user_snippets_path(user)
wait_for_requests()
2016-05-25 15:32:37 -04:00
2016-12-08 17:13:23 -05:00
page.find('.js-timeago.snippet-created-ago').hover
2016-05-25 15:32:37 -04:00
end
it 'has the datetime formated correctly' do
expect(page).to have_selector('.local-timeago', text: expected_format)
end
end
end