Module: SolidusDevSupport::TestingSupport::Factories

Defined in:
lib/solidus_dev_support/testing_support/factories.rb

Class Method Summary collapse

Class Method Details

.load_for(*engines) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/solidus_dev_support/testing_support/factories.rb', line 9

def self.load_for(*engines)
  paths = engines.flat_map do |engine|
    engine.root.glob('lib/**/testing_support/factories{,.rb}')
  end.map { |path| path.sub(/.rb\z/, '').to_s }

  FactoryBot.definition_file_paths = [
    Spree::TestingSupport::FactoryBot.definition_file_paths,
    paths,
  ].flatten

  FactoryBot.reload
end