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
Ensure existing unread notifications are marked as read
Kabiru Mwenjacd74446e4caf
diff --git a/spec/factories/reminders_factory.rb b/spec/factories/reminders_factory.rbindex 982038d75e7..c1b1bd0d50d 100644--- a/spec/factories/reminders_factory.rb+++ b/spec/factories/reminders_factory.rb@@ -39,13 +39,13 @@ FactoryBot.define dotrait :with_unread_notifications doafter(:create) do |reminder|- create(:reminder_notification, reminder: reminder, notification: create(:notification, read_ian: false))+ create(:reminder_notification, reminder:, notification: create(:notification, read_ian: false))endendtrait :with_read_notifications doafter(:create) do |reminder|- create(:reminder_notification, reminder: reminder, notification: create(:notification, read_ian: true))+ create(:reminder_notification, reminder:, notification: create(:notification, read_ian: true))endendenddiff --git a/spec/services/reminders/update_service_spec.rb b/spec/services/reminders/update_service_spec.rbindex 1f4822a6f1d..441597c7fa9 100644--- a/spec/services/reminders/update_service_spec.rb+++ b/spec/services/reminders/update_service_spec.rb@@ -39,7 +39,7 @@ RSpec.describe Reminders::UpdateService dodescribe "remind_at changed" dosubject { described_class.new(user:, model: model_instance).call(call_attributes) }- let(:model_instance) { create(:reminder, :scheduled, creator: user, job_id: 1) }+ let(:model_instance) { create(:reminder, :scheduled, :with_unread_notifications, creator: user, job_id: 1) }let(:user) { create(:admin) }let(:call_attributes) { { remind_at: 2.days.from_now } }@@ -64,6 +64,11 @@ RSpec.describe Reminders::UpdateService doexpect(job).to have_received(:destroy)end+ aggregate_failures "marks unread notifications as read" do+ expect(model_instance.notifications.count).to eq(1)+ expect(model_instance.unread_notifications.count).to eq(0)+ end+aggregate_failures "schedule new job" doexpect(Reminders::ScheduleReminderJob).to have_received(:schedule).with(model_instance)end