Module: FactoryBotCaching::CachingFactoryRunner

Defined in:
lib/factory_bot_caching/caching_factory_runner.rb

Instance Method Summary collapse

Instance Method Details

#run(runner_strategy = @strategy, &block) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/factory_bot_caching/caching_factory_runner.rb', line 30

def run(runner_strategy = @strategy, &block)
  # We have to define the cache here so that it has access to super.
  if FactoryBotCaching.enabled? && runner_strategy == :create
    CacheManager.instance.fetch(name:      @name,
                                overrides: @overrides,
                                traits:    @traits) do
      super
    end
  else
    super
  end
end