1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
# frozen_string_literal: true
module TestProf
module FactoryProf
# Wrap #run method with FactoryProf tracking
module FactoryBotPatch
def run(strategy = @strategy)
variation = ""
if FactoryProf.config.include_variations?
if @traits || @overrides
unless @traits.empty?
variation += @traits.sort.join(".").prepend(".")
end
unless @overrides.empty?
variation += @overrides.keys.sort.to_s.gsub(/[\\":]/, "")
end
end
end
FactoryBuilders::FactoryBot.track(strategy, @name, variation: variation.to_sym) { super }
end
end
end
end
|