Module: TestProf::FactoryDefault::DefaultSyntax

Defined in:
lib/test_prof/factory_default.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#create_default(name, *args, &block) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/test_prof/factory_default.rb', line 11

def create_default(name, *args, &block)
  options = args.extract_options!
  preserve = options.delete(:preserve_traits)

  obj = TestProf::FactoryBot.create(name, *args, options, &block)
  set_factory_default(name, obj, preserve_traits: preserve)
end

#set_factory_default(name, obj, preserve_traits: nil) ⇒ Object



19
20
21
# File 'lib/test_prof/factory_default.rb', line 19

def set_factory_default(name, obj, preserve_traits: nil)
  FactoryDefault.register(name, obj, preserve_traits: preserve_traits)
end