Module: SolidusLegacyPromotions::TestingSupport::FactoryBot

Defined in:
lib/solidus_legacy_promotions/testing_support/factory_bot.rb

Constant Summary collapse

FACTORIES =
Dir["#{::SolidusLegacyPromotions::Engine.root}/lib/solidus_legacy_promotions/testing_support/factories/**/*_factory.rb"].sort

Class Method Summary collapse

Class Method Details

.add_definitions!Object



18
19
20
# File 'lib/solidus_legacy_promotions/testing_support/factory_bot.rb', line 18

def self.add_definitions!
  ::FactoryBot.definition_file_paths.unshift(*definition_file_paths).uniq!
end

.add_paths_and_load!Object



22
23
24
25
# File 'lib/solidus_legacy_promotions/testing_support/factory_bot.rb', line 22

def self.add_paths_and_load!
  add_definitions!
  ::FactoryBot.reload
end

.definition_file_pathsObject



14
15
16
# File 'lib/solidus_legacy_promotions/testing_support/factory_bot.rb', line 14

def self.definition_file_paths
  @paths ||= FACTORIES.map { |path| path.sub(/.rb\z/, '') }
end