Module: Crystalball::MapGenerator::FactoryBotStrategy::DSLPatch::FactoryPathFetcher
- Defined in:
- lib/crystalball/map_generator/factory_bot_strategy/dsl_patch/factory_path_fetcher.rb
Overview
This module is used to fetch file path with factory definition from callstack
Class Method Summary collapse
-
.fetch ⇒ String
Fetches file path with factory definition from callstack.
Class Method Details
.fetch ⇒ String
Fetches file path with factory definition from callstack
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/crystalball/map_generator/factory_bot_strategy/dsl_patch/factory_path_fetcher.rb', line 12 def self.fetch factories_definition_paths = FactoryBotStrategy .factory_bot_constant .definition_file_paths .map { |path| Pathname(path)..to_s } factory_definition_call = caller.find do |method_call| factories_definition_paths.any? do |path| method_call.start_with?(path) end end factory_definition_call.split(':').first end |