Sha256: 06a1ae5917f9243ae1722e0522c39579b853640a301d5e5d62c9dd2938274fad

Contents?: true

Size: 843 Bytes

Versions: 3

Compression:

Stored size: 843 Bytes

Contents

module FactoryBot
  # @api private
  class Configuration
    attr_reader :factories, :sequences, :traits, :strategies, :callback_names

    def initialize
      @factories      = Decorator::DisallowsDuplicatesRegistry.new(Registry.new("Factory"))
      @sequences      = Decorator::DisallowsDuplicatesRegistry.new(Registry.new("Sequence"))
      @traits         = Decorator::DisallowsDuplicatesRegistry.new(Registry.new("Trait"))
      @strategies     = Registry.new("Strategy")
      @callback_names = Set.new
      @definition     = Definition.new(:configuration)

      to_create(&:save!)
      initialize_with { new }
    end

    delegate :to_create, :skip_create, :constructor, :before, :after,
      :callback, :callbacks, to: :@definition

    def initialize_with(&block)
      @definition.define_constructor(&block)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
factory_bot-5.0.0 lib/factory_bot/configuration.rb
factory_bot-5.0.0.rc2 lib/factory_bot/configuration.rb
factory_bot-5.0.0.rc1 lib/factory_bot/configuration.rb