This will be improved in rom 6.0.0. Notice that Entities::Foo is not actually the struct class that’s gonna be used. rom generates struct sub-classes for each unique schema that you use. ie users.select(:id, :name) doesn’t create instances of User entity but its subclass that only has id and name attributes defined. This is going to be changed so that the canonical class is also the one with the default schema.
describe Entities::Entity do
let(:described_class) { App["repositories.entities_repo"].entities.mapper.model }
let(:subject) do
described_class.new(id: 1, first_name: 'Michael', last_name: "Knight")
end
describe "#full_name" do
it "should return its full_name" do
expect(subject.full_name).to eq("Michael Knigth")
end
end
end