class CreateStrategy

Public Class Methods

new() click to toggle source
# File spec/support/factory_bot.rb, line 2
def initialize
  @strategy = FactoryBot.strategy_by_name(:create).new
end

Public Instance Methods

result(evaluation) click to toggle source
# File spec/support/factory_bot.rb, line 8
def result(evaluation)
  result = nil
  evaluation.object.tap do |instance|
    evaluation.notify(:after_build, instance)
    evaluation.notify(:before_create, instance)
    result = evaluation.create(instance)
    evaluation.notify(:after_create, result)
  end

  result
end