module FactoryBot::Internal
@api private
Public Class Methods
configuration()
click to toggle source
# File lib/factory_bot/internal.rb, line 19 def configuration @configuration ||= Configuration.new end
factory_by_name(name)
click to toggle source
# File lib/factory_bot/internal.rb, line 69 def factory_by_name(name) factories.find(name) end
register_default_strategies()
click to toggle source
# File lib/factory_bot/internal.rb, line 82 def register_default_strategies register_strategy(:build, FactoryBot::Strategy::Build) register_strategy(:create, FactoryBot::Strategy::Create) register_strategy(:attributes_for, FactoryBot::Strategy::AttributesFor) register_strategy(:build_stubbed, FactoryBot::Strategy::Stub) register_strategy(:null, FactoryBot::Strategy::Null) end
register_factory(factory)
click to toggle source
# File lib/factory_bot/internal.rb, line 62 def register_factory(factory) factory.names.each do |name| factories.register(name, factory) end factory end
register_inline_sequence(sequence)
click to toggle source
# File lib/factory_bot/internal.rb, line 27 def register_inline_sequence(sequence) inline_sequences.push(sequence) end
register_sequence(sequence)
click to toggle source
# File lib/factory_bot/internal.rb, line 46 def register_sequence(sequence) sequence.names.each do |name| sequences.register(name, sequence) end sequence end
register_strategy(strategy_name, strategy_class)
click to toggle source
# File lib/factory_bot/internal.rb, line 73 def register_strategy(strategy_name, strategy_class) strategies.register(strategy_name, strategy_class) StrategySyntaxMethodRegistrar.new(strategy_name).define_strategy_methods end
register_trait(trait)
click to toggle source
# File lib/factory_bot/internal.rb, line 35 def register_trait(trait) trait.names.each do |name| traits.register(name, trait) end trait end
reset_configuration()
click to toggle source
# File lib/factory_bot/internal.rb, line 23 def reset_configuration @configuration = nil end
rewind_inline_sequences()
click to toggle source
# File lib/factory_bot/internal.rb, line 31 def rewind_inline_sequences inline_sequences.each(&:rewind) end
rewind_sequences()
click to toggle source
# File lib/factory_bot/internal.rb, line 57 def rewind_sequences sequences.each(&:rewind) rewind_inline_sequences end
sequence_by_name(name)
click to toggle source
# File lib/factory_bot/internal.rb, line 53 def sequence_by_name(name) sequences.find(name) end
strategy_by_name(name)
click to toggle source
# File lib/factory_bot/internal.rb, line 78 def strategy_by_name(name) strategies.find(name) end
trait_by_name(name)
click to toggle source
# File lib/factory_bot/internal.rb, line 42 def trait_by_name(name) traits.find(name) end