attributes
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user