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

reload model instance to verify state change

Kabiru Mwenja6602153e7be7
diff --git a/spec/services/reminders/update_service_spec.rb b/spec/services/reminders/update_service_spec.rb
index 441597c7fa9..73bcdbf78e8 100644
--- a/spec/services/reminders/update_service_spec.rb
+++ b/spec/services/reminders/update_service_spec.rb
@@ -57,7 +57,7 @@ RSpec.describe Reminders::UpdateService do
end
it "reschedules the reminder" do
- expect { subject }.to change(model_instance, :job_id).from("1").to("2")
+ expect { subject }.to change(model_instance.reload, :job_id).from("1").to("2")
aggregate_failures "destroy existing job" do
expect(GoodJob::Job).to have_received(:find_by).with(id: "1")
@@ -83,7 +83,7 @@ RSpec.describe Reminders::UpdateService do
end
it "schedules a new job" do
- expect { subject }.to change(model_instance, :job_id).from("1").to("2")
+ expect { subject }.to change(model_instance.reload, :job_id).from("1").to("2")
aggregate_failures "does NOT destroy existing job" do
expect(GoodJob::Job).to have_received(:find_by).with(id: "1")
@@ -100,7 +100,7 @@ RSpec.describe Reminders::UpdateService do
let(:call_attributes) { { remind_at: 2.days.from_now.in_time_zone("Africa/Nairobi") } }
it "schedules the reminder" do
- expect { subject }.to change(model_instance, :job_id).from("1").to("2")
+ expect { subject }.to change(model_instance.reload, :job_id).from("1").to("2")
end
end
end