attributes

This commit is contained in:
Dylan Knutson
2025-07-17 22:03:47 +00:00
parent d83d6833ad
commit d112d8b72d
3 changed files with 34 additions and 0 deletions

View File

@@ -187,6 +187,20 @@ RSpec.describe HasAuxTable do
end
end
it "has the right #attributes" do
car =
Car.create!(name: "Honda Civic", fuel_type: "gasoline", engine_size: 2.0)
expect(car.attributes).to match(
"type" => "Car",
"id" => car.id,
"name" => "Honda Civic",
"fuel_type" => "gasoline",
"engine_size" => be_within(0.001).of(2.0),
"created_at" => be_within(0.001).of(car.created_at),
"updated_at" => be_within(0.001).of(car.updated_at)
)
end
describe "database integration" do
it "provides automatic attribute accessors for auxiliary table columns" do
vehicle = Car.create!(name: "Honda Civic")