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