2017-10-20 15:20:28 -04:00
|
|
|
module FactoryBot
|
2012-04-13 14:20:19 -04:00
|
|
|
module Strategy
|
|
|
|
class Create
|
2012-02-10 16:56:07 -05:00
|
|
|
def association(runner)
|
|
|
|
runner.run
|
2012-02-08 09:56:04 -05:00
|
|
|
end
|
|
|
|
|
2012-04-13 14:20:19 -04:00
|
|
|
def result(evaluation)
|
|
|
|
evaluation.object.tap do |instance|
|
|
|
|
evaluation.notify(:after_build, instance)
|
|
|
|
evaluation.notify(:before_create, instance)
|
|
|
|
evaluation.create(instance)
|
|
|
|
evaluation.notify(:after_create, instance)
|
2011-12-16 11:30:04 -05:00
|
|
|
end
|
2008-12-23 14:03:29 -05:00
|
|
|
end
|
2022-02-03 21:41:09 -05:00
|
|
|
|
|
|
|
def to_sym
|
|
|
|
:create
|
|
|
|
end
|
2008-12-23 14:03:29 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|