OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Set a fixed reminder time to ensure the spec always works
Oliver Güntherd9f2dd8bd02e
diff --git a/spec/features/notifications/reminder_mail_spec.rb b/spec/features/notifications/reminder_mail_spec.rbindex f5e7658e802..665a975c883 100644--- a/spec/features/notifications/reminder_mail_spec.rb+++ b/spec/features/notifications/reminder_mail_spec.rb@@ -14,8 +14,15 @@ describe "Reminder email sending", type: :feature, js: true do# time zone. For the time zone Hawaii (UTC-10) this means between 8:00:00 and 8:14:59 UTC.# The job is scheduled to run every 15 min so the run_at will in production always move between the quarters of an hour.# The current time can be way behind that.- let(:current_utc_time) { ActiveSupport::TimeZone['Pacific/Honolulu'].parse("08:34:10").utc }- let(:job_run_at) { ActiveSupport::TimeZone['Pacific/Honolulu'].parse("08:00").utc }+ let(:current_utc_time) {ActiveSupport::TimeZone['Pacific/Honolulu'].parse("2021-09-30T08:34:10").utc }+ let(:job_run_at) { ActiveSupport::TimeZone['Pacific/Honolulu'].parse("2021-09-30T08:00:00").utc }++ # Fix the time of the specs to ensure a consistent run+ around do |example|+ Timecop.travel(current_utc_time) do+ example.run+ end+ endcurrent_user doFactoryBot.create(@@ -42,9 +49,6 @@ describe "Reminder email sending", type: :feature, js: true doendbefore do- allow(Time).to receive(:current).and_return(current_utc_time)- allow(Time).to receive(:now).and_return(current_utc_time)-watched_work_packagework_packageinvolved_work_packagediff --git a/spec/models/users/scopes/having_reminder_mail_to_send_spec.rb b/spec/models/users/scopes/having_reminder_mail_to_send_spec.rbindex d5aafc6a2f4..1eec7bb8366 100644--- a/spec/models/users/scopes/having_reminder_mail_to_send_spec.rb+++ b/spec/models/users/scopes/having_reminder_mail_to_send_spec.rb@@ -35,7 +35,7 @@ describe User, '.having_reminder_mail_to_send', type: :model dodescribed_class.having_reminder_mail_to_send(scope_time)end- # Fix the time of the specs to ensure a consistent+ # Fix the time of the specs to ensure a consistent runaround do |example|Timecop.travel(current_time) doexample.run