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

Query::Timestamps: fixing inconsistent spec

Sebastian Fiedlschuster3e415dbbea8a
diff --git a/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb b/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb
index eabf31810fe..e8ee4339fd7 100644
--- a/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb
+++ b/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb
@@ -22,7 +22,14 @@ describe "Notification center date alerts", js: true, with_settings: { journal_a
def create_alertable(**attributes)
attributes = attributes.reverse_merge(assigned_to: user, project:)
- create(:work_package, **attributes)
+ work_package = create(:work_package, **attributes)
+
+ # TimeCop sets the current time to 1:04h below. To be compatible to historic searches,
+ # we need to pretend that the journal records have been created before that time.
+ # https://github.com/opf/openproject/pull/11678#issuecomment-1328011996
+ #
+ work_package.journals.update_all created_at: Time.zone.now.change(hour: 0, minute: 0)
+ work_package
end
# notification will be created by the job because `overdue: 1` in user notifications settings