Sha256: 1cf0d40efe12929b2b9b74e77a416b648f14196a2d7ecce4f317bfed14d9e750

Contents?: true

Size: 935 Bytes

Versions: 4

Compression:

Stored size: 935 Bytes

Contents

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

    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)
      @inline_sequences = []

      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

4 entries across 4 versions & 1 rubygems

Version Path
factory_bot-5.1.1 lib/factory_bot/configuration.rb
factory_bot-5.1.0 lib/factory_bot/configuration.rb
factory_bot-5.0.2 lib/factory_bot/configuration.rb
factory_bot-5.0.1 lib/factory_bot/configuration.rb