Class: FactoryBot::Configuration Private

Inherits:
Object
  • Object
show all
Defined in:
lib/factory_bot/configuration.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

API:

  • private

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Configuration.

API:

  • private



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/factory_bot/configuration.rb', line 8

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

  @allow_class_lookup = true

  to_create { |instance| instance.save! }
  initialize_with { new }
end

Instance Attribute Details

#allow_class_lookupObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



6
7
8
# File 'lib/factory_bot/configuration.rb', line 6

def allow_class_lookup
  @allow_class_lookup
end

#callback_namesObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



4
5
6
# File 'lib/factory_bot/configuration.rb', line 4

def callback_names
  @callback_names
end

#factoriesObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



4
5
6
# File 'lib/factory_bot/configuration.rb', line 4

def factories
  @factories
end

#sequencesObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



4
5
6
# File 'lib/factory_bot/configuration.rb', line 4

def sequences
  @sequences
end

#strategiesObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



4
5
6
# File 'lib/factory_bot/configuration.rb', line 4

def strategies
  @strategies
end

#traitsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



4
5
6
# File 'lib/factory_bot/configuration.rb', line 4

def traits
  @traits
end

#use_parent_strategyObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



6
7
8
# File 'lib/factory_bot/configuration.rb', line 6

def use_parent_strategy
  @use_parent_strategy
end

Instance Method Details

#duplicate_attribute_assignment_from_initialize_withObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



29
30
31
# File 'lib/factory_bot/configuration.rb', line 29

def duplicate_attribute_assignment_from_initialize_with
  false
end

#duplicate_attribute_assignment_from_initialize_with=(value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



33
34
35
# File 'lib/factory_bot/configuration.rb', line 33

def duplicate_attribute_assignment_from_initialize_with=(value)
  ActiveSupport::Deprecation.warn 'Assignment of duplicate_attribute_assignment_from_initialize_with is unnecessary as this is now default behavior in FactoryBot 4.0; this line can be removed', caller
end

#initialize_with(&block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



25
26
27
# File 'lib/factory_bot/configuration.rb', line 25

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