Skip to content

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

Add more tests

Christophe Bliard8efd96f7608b
diff --git a/spec/workers/notifications/create_date_alerts_notifications_job/alertable_work_packages_spec.rb b/spec/workers/notifications/create_date_alerts_notifications_job/alertable_work_packages_spec.rb
index 0d24858929d..1a66f13632a 100644
--- a/spec/workers/notifications/create_date_alerts_notifications_job/alertable_work_packages_spec.rb
+++ b/spec/workers/notifications/create_date_alerts_notifications_job/alertable_work_packages_spec.rb
@@ -332,6 +332,8 @@ RSpec.describe Notifications::CreateDateAlertsNotificationsJob::AlertableWorkPac
include_examples 'not alertable if due', days_ago: 2
include_examples 'not alertable if due', days_ago: 3
include_examples 'alertable if due', days_ago: 4
+ include_examples 'not alertable if due', days_ago: 5
+ include_examples 'not alertable if due', days_ago: 6
include_examples 'alertable if due', days_ago: 7
end
@@ -347,6 +349,7 @@ RSpec.describe Notifications::CreateDateAlertsNotificationsJob::AlertableWorkPac
include_examples 'not alertable if due', days_ago: 4
include_examples 'not alertable if due', days_ago: 7
include_examples 'alertable if due', days_ago: 8
+ include_examples 'not alertable if due', days_ago: 12
include_examples 'alertable if due', days_ago: 15
end
diff --git a/spec/workers/notifications/create_date_alerts_notifications_job_spec.rb b/spec/workers/notifications/create_date_alerts_notifications_job_spec.rb
index 451ae33d0eb..0cd79208c68 100644
--- a/spec/workers/notifications/create_date_alerts_notifications_job_spec.rb
+++ b/spec/workers/notifications/create_date_alerts_notifications_job_spec.rb
@@ -377,5 +377,18 @@ describe Notifications::CreateDateAlertsNotificationsJob, type: :job do
expect(user_paris).not_to have_a_start_date_alert_notification_for(work_package)
end
end
+
+ context 'when scheduled at 01:00 am Paris local time and executed at 01:37 am' do
+ it 'creates a start date alert notification for a user in the same time zone' do
+ work_package = alertable_work_package
+
+ set_scheduled_time(timezone_paris.now.change(hour: 1, min: 0))
+ travel_to(timezone_paris.now.change(hour: 1, min: 37))
+
+ scheduled_job.invoke_job
+
+ expect(user_paris).to have_a_start_date_alert_notification_for(work_package)
+ end
+ end
end
end