association reloading

This commit is contained in:
Dylan Knutson
2025-07-19 00:14:56 +00:00
parent a526fb54f1
commit 42d3ce97d9
2 changed files with 34 additions and 8 deletions

View File

@@ -758,6 +758,18 @@ RSpec.describe HasAuxTable do
num_queries = SpecHelper.count_queries { @car.reload }
expect(num_queries).to eq(1)
end
it "reloads associations" do
expect(@car.drivers.length).to eq(0)
Driver.create!(car: @car, name: "Billy Kid")
expect(@car.drivers.length).to eq(0)
expect(@car.drivers.count).to eq(1)
@car.reload
expect(@car.drivers.length).to eq(1)
expect(@car.drivers.count).to eq(1)
end
end
describe "#exists?" do