Module: TestProf::FactoryDefault::DefaultSyntax
- Defined in:
- lib/test_prof/factory_default.rb
Overview
:nodoc:
Instance Method Summary collapse
- #create_default(name, *args, &block) ⇒ Object
- #set_factory_default(name, obj, preserve_traits: nil) ⇒ Object
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) = args. preserve = .delete(:preserve_traits) obj = TestProf::FactoryBot.create(name, *args, , &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 |