inspect attributes

This commit is contained in:
Dylan Knutson
2025-07-17 18:27:57 +00:00
parent f3990e2654
commit 502b9cb5fe
6 changed files with 235 additions and 210 deletions

View File

@@ -165,6 +165,25 @@ RSpec.describe HasAuxTable do
it "does not include the aux table foreign key" do
expect(Car.inspect).not_to include("base_table_id")
end
it "reports created_at, updated_at timestamp columns at the end of the list" do
expect(Car.inspect).to match(/\bfuel_type\b.+\bupdated_at\b/)
expect(Car.inspect).to match(/\bname\b.+\bupdated_at\b/)
end
it "includes columns in instances of the model" do
car = Car.create!(name: "Honda Civic")
expect(car.inspect).to include("fuel_type")
expect(car.inspect).to include("engine_size")
expect(car.inspect).to include("created_at")
expect(car.inspect).to include("updated_at")
end
it "puts _at columns at the end of the list on instances" do
car = Car.create!(name: "Honda Civic")
expect(car.inspect).to match(/\bfuel_type\b.+\bupdated_at\b/)
expect(car.inspect).to match(/\bname\b.+\bupdated_at\b/)
end
end
describe "database integration" do