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
Harden specs for pausing mail notifications with different time zones
Wieland Lindenthalbe0d6bbdb740
diff --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 e97445c1998..c16f5b2cd9f 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@@ -43,7 +43,7 @@ describe User, '.having_reminder_mail_to_send', type: :model doend# Let the date be one where workdays are enabled by default- # to avoid specifying them explictly+ # to avoid specifying them explicitlylet(:current_time) { "2021-09-30T08:10:59Z".to_datetime }let(:scope_time) { "2021-09-30T08:00:00Z".to_datetime }@@ -163,10 +163,16 @@ describe User, '.having_reminder_mail_to_send', type: :model dodaily_reminders: {enabled: true,times: [hitting_reminder_slot_for("Pacific/Honolulu", current_time)]- }+ },+ pause_reminders: hawaii_user_pause_reminders})end+ let(:hawaii_user_pause_reminders) do+ {+ enabled: false+ }+ endlet(:notifications) doFactoryBot.create(:notification, recipient: hawaii_user, created_at: 5.minutes.ago)end@@ -186,6 +192,38 @@ describe User, '.having_reminder_mail_to_send', type: :model do.to be_emptyendend++ context 'with local date range for pausing' do+ context 'that includes scope_time' do+ let(:hawaii_user_pause_reminders) do+ {+ enabled: true,+ first_day: '2021-09-29',+ last_day: '2021-09-29'+ }+ end++ it 'is empty' do+ expect(scope)+ .to be_empty+ end+ end++ context 'that excludes scope_time' do+ let(:hawaii_user_pause_reminders) do+ {+ enabled: true,+ first_day: '2021-09-30',+ last_day: '2021-09-30'+ }+ end++ it 'contains the user' do+ expect(scope)+ .to match_array([hawaii_user])+ end+ end+ endendcontext 'for a user whose local time is on the next workday' do