Class: FactoryBotFactory::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/factory_bot_factory/base.rb

Class Method Summary collapse

Class Method Details

.build(factory_name, klass, data, options = {}) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/factory_bot_factory/base.rb', line 4

def build(factory_name, klass, data, options = {})
  raise NestedToDeepError, 'Only support 5 nested levels' if options[:nested_level].to_i > 5

  factory(klass, data).new(options.merge(factory_name: factory_name)).generate(data)
rescue => e
  puts "Please check your input data and make sure you pass supported type of factory."
end