Open jcoyne opened 12 months ago
How does this work? Is it really transient? https://github.com/thoughtbot/factory_bot/blob/main/GETTING_STARTED.md#with-associations
You could still refer to ‘location’ if you used ‘association’ instead of ‘build’, right?
With this in mind, can this be written as:
FactoryBot.define do
factory :holding do
location factory: :gre_stacks
item { association(:item, :available, location:) }
end
?
@pirj item is not really a property of holding, it's a transient that is later used by initialize_with
, so I don't think association
will work.
I see. Thanks for reporting. Might be a duplicate of https://github.com/rubocop/rubocop-factory_bot/issues/61, but not necessarily.
This cop needs to be fixed not to bark inside transient blocks
A PR is welcome, @Abdullah-l
I don't think there is another way to write this given that location references another transient: