diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2016-05-25 14:32:37 -0500 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-06-09 14:38:24 -0500 |
commit | 340aa444b709291958f2ab3a21352d9e182705d8 (patch) | |
tree | 0b901274bfca4ca0115672a7974b69bdbeccaf6b /spec | |
parent | 6ae82d57075cc8c6eff613877781ac14a09a2040 (diff) | |
download | gitlab-ce-340aa444b709291958f2ab3a21352d9e182705d8.tar.gz |
Add tests for dates on tooltips
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/dashboard/datetime_on_tooltips_spec.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/features/dashboard/datetime_on_tooltips_spec.rb b/spec/features/dashboard/datetime_on_tooltips_spec.rb new file mode 100644 index 00000000000..e77db0dd2a2 --- /dev/null +++ b/spec/features/dashboard/datetime_on_tooltips_spec.rb @@ -0,0 +1,46 @@ +require 'spec_helper' + +feature 'Tooltips on .timeago dates', feature: true, js: true do + include WaitForAjax + + 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.strftime('%b %d, %Y %l:%M%P UTC') } + + 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) + + login_as user + visit user_path(user) + wait_for_ajax() + + 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) + + login_as user + visit user_snippets_path(user) + wait_for_ajax() + + 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 +end |