rom-rb / rom-factory

Data generator with support for persistence backends
MIT License
83 stars 42 forks source link

Allow for option to override association factory name #37

Open cmavromoustakos opened 5 years ago

cmavromoustakos commented 5 years ago

I have a unique problem where my Repo/Entity is called indie as in an Indie artist. The infer_factory_name(name) method https://github.com/rom-rb/rom-factory/blob/v0.6.0/lib/rom/factory/factories.rb#L203 tries looking for the Indy factory which does not exist.

graudeejs commented 5 years ago

You are not alone. I'm having same issue in v0.9.0

solnic commented 5 years ago

Please provide a reproduction script

izikaj commented 4 years ago

+1 Have same problem Simple workaround - create alias from required factory:

FactoryBot.define(:store_products) do |f|
  f.title { fake(:device, :model_name) }
  f.description { fake(:lorem, :paragraph) }
  f.timestamps
end

FactoryBot.define(store_product: :store_products) do |f|
end

FactoryBot.define(:store_product_prices) do |f|
  f.description { fake(:lorem, :paragraph) }
  f.association(:product)
  f.timestamps
end