File: fabrication_patch.rb

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

module TestProf
  module FactoryProf
    # Wrap #run method with FactoryProf tracking
    module FabricationPatch
      def create(name, overrides = {})
        variation = ""

        if FactoryProf.config.include_variations? && !overrides.empty?
          variation += overrides.keys.sort.to_s.gsub(/[\\":]/, "")
        end

        FactoryBuilders::Fabrication.track(name, variation: variation.to_sym) { super }
      end
    end
  end
end