Skip to content

Commit edf9fae

Browse files
add_before_build_callbcak
1 parent c000b9e commit edf9fae

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

lib/factory_bot/strategy/build.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ def association(runner)
77

88
def result(evaluation)
99
evaluation.object.tap do |instance|
10+
evaluation.notify(:before_build, instance)
1011
evaluation.notify(:after_build, instance)
1112
end
1213
end

lib/factory_bot/strategy/create.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ def association(runner)
77

88
def result(evaluation)
99
evaluation.object.tap do |instance|
10+
evaluation.notify(:before_build, instance)
1011
evaluation.notify(:after_build, instance)
1112
evaluation.notify(:before_create, instance)
1213
evaluation.create(instance)

0 commit comments

Comments
 (0)