Skip to content

Commit

Permalink
reload model instance to verify state change
Browse files Browse the repository at this point in the history
In CI env the change is not seen for some odd reason- passes locally

```ruby
 expected `Reminder#job_id` to have changed from "1" to "2", but did not change
```
  • Loading branch information
akabiru committed Nov 28, 2024
1 parent cd74446 commit 6602153
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions spec/services/reminders/update_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
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")
Expand All @@ -83,7 +83,7 @@
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")
Expand All @@ -100,7 +100,7 @@
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
Expand Down

0 comments on commit 6602153

Please sign in to comment.