With the addition of ROM::Factory::UnknownFactoryAttributes, it has become apparent that attributes passed to structs are also passed into their many-to-one associations. This PR addresses the issue and tests that it does not cause errors for one-to-one, one-to-many, or many-to-one associations.
Here's an example:
factories.define(:task) do |f|
f.title { 'Foo' }
f.association(:user)
end
factories.define(:user) do |f|
f.timestamps
end
Currently, attributes provided to the task struct are being passed into the user association:
With the addition of
ROM::Factory::UnknownFactoryAttributes
, it has become apparent that attributes passed to structs are also passed into their many-to-one associations. This PR addresses the issue and tests that it does not cause errors for one-to-one, one-to-many, or many-to-one associations.Here's an example:
Currently, attributes provided to the
task
struct are being passed into theuser
association:This PR makes it possible to build such structs without exceptions: