File: factory_bot_patch.rb

package info (click to toggle)
ruby-test-prof 0.12.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 508 kB
  • sloc: ruby: 4,075; makefile: 4
file content (16 lines) | stat: -rw-r--r-- 384 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

require "test_prof/ext/factory_bot_strategy"

module TestProf
  module FactoryDoctor
    # Wrap #run method with FactoryDoctor tracking
    module FactoryBotPatch
      using TestProf::FactoryBotStrategy

      def run(strategy = @strategy)
        FactoryDoctor.within_factory(strategy.create? ? :create : :other) { super }
      end
    end
  end
end