From 856abd48f130f3eab29ee24f877648aa40680e09 Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Fri, 30 Dec 2016 09:29:00 +0000 Subject: Warn when running TZ-dependent spec outside UTC --- spec/features/dashboard/datetime_on_tooltips_spec.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/spec/features/dashboard/datetime_on_tooltips_spec.rb b/spec/features/dashboard/datetime_on_tooltips_spec.rb index 44dfc2dff45..3f97b886488 100644 --- a/spec/features/dashboard/datetime_on_tooltips_spec.rb +++ b/spec/features/dashboard/datetime_on_tooltips_spec.rb @@ -8,6 +8,14 @@ feature 'Tooltips on .timeago dates', feature: true, js: true do let(:created_date) { Date.yesterday.to_time } let(:expected_format) { created_date.strftime('%b %-d, %Y %l:%M%P UTC') } + before(:all) do + if Time.now.getlocal.zone != 'UTC' + $stderr.puts "WARNING: This spec (#{__FILE__}) only works in the UTC time zone." + $stderr.puts '' + $stderr.puts 'Set TZ=UTC when running this spec to force the time zone to UTC.' + end + end + context 'on the activity tab' do before do project.team << [user, :master] @@ -17,7 +25,7 @@ feature 'Tooltips on .timeago dates', feature: true, js: true do login_as user visit user_path(user) - wait_for_ajax() + wait_for_ajax page.find('.js-timeago').hover end @@ -34,7 +42,7 @@ feature 'Tooltips on .timeago dates', feature: true, js: true do login_as user visit user_snippets_path(user) - wait_for_ajax() + wait_for_ajax page.find('.js-timeago.snippet-created-ago').hover end -- cgit v1.2.1