Module: Crystalball::MapGenerator::FactoryBotStrategy::FactoryRunnerPatch
- Defined in:
- lib/crystalball/map_generator/factory_bot_strategy/factory_runner_patch.rb
Overview
Module to add new ‘run` method to FactoryBot::FactoryRunner
Class Method Summary collapse
-
.apply! ⇒ Object
Patches ‘FactoryBot::FactoryRunner#run`.
Instance Method Summary collapse
-
#run ⇒ Object
Overrides ‘FactoryBot::FactoryRunner#run`.
Class Method Details
.apply! ⇒ Object
Patches ‘FactoryBot::FactoryRunner#run`.
10 11 12 |
# File 'lib/crystalball/map_generator/factory_bot_strategy/factory_runner_patch.rb', line 10 def apply! FactoryBotStrategy.factory_bot_constant::FactoryRunner.prepend FactoryRunnerPatch end |
Instance Method Details
#run ⇒ Object
Overrides ‘FactoryBot::FactoryRunner#run`. Pushes factory name to `FactoryBotStrategy.used_factories` and calls original `run`
17 18 19 20 21 |
# File 'lib/crystalball/map_generator/factory_bot_strategy/factory_runner_patch.rb', line 17 def run(*) factory = FactoryBotStrategy.factory_bot_constant.factory_by_name(@name) FactoryBotStrategy.used_factories << factory.name.to_s super end |