*_attribute methods take String or Symbol

This commit is contained in:
Dylan Knutson
2025-07-19 05:13:14 +00:00
parent 42d3ce97d9
commit 6ba5a70bb5
2 changed files with 9 additions and 1 deletions

View File

@@ -77,6 +77,14 @@ RSpec.describe HasAuxTable do
)
end
it "reads attributes with read_attribute" do
car = Car.create!(name: "Honda Civic", fuel_type: "gasoline")
expect(car.read_attribute("name")).to eq("Honda Civic")
expect(car.read_attribute(:name)).to eq("Honda Civic")
expect(car.read_attribute("fuel_type")).to eq("gasoline")
expect(car.read_attribute(:fuel_type)).to eq("gasoline")
end
it "can be created as the base class" do
vehicle = Vehicle.create(type: "Vehicle", name: "big tractor")
expect(vehicle.attributes).to match(