Sha256: f205facd8d65268b78227e90cabae18cf47f7fd074bfc5c70389f4ebbd1bfef8
Contents?: true
Size: 503 Bytes
Versions: 30
Compression:
Stored size: 503 Bytes
Contents
class CreateStrategy def initialize @strategy = FactoryBot.strategy_by_name(:create).new end delegate :association, to: :@strategy 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 end FactoryBot.register_strategy(:repo_create, CreateStrategy)
Version data entries
30 entries across 30 versions & 1 rubygems