mirror of
https://github.com/thoughtbot/factory_bot.git
synced 2022-11-09 11:43:51 -05:00
1b81d5dc25
What? ===== Within FactoryBot::Evaluator, the build strategy was reported either as a class OR symbol. A side-effect of this is misreporting within ActiveSupport::Notifications hooks, since the instrumentation payload may have strategies listed as e.g. `:create` or `FactoryBot::Strategy::Create`, even though they semantically represent the same information. This introduces a new instance method for all strategies, `to_sym`, to be called rather than `class`.
19 lines
320 B
Ruby
19 lines
320 B
Ruby
module FactoryBot
|
|
module Strategy
|
|
class Build
|
|
def association(runner)
|
|
runner.run
|
|
end
|
|
|
|
def result(evaluation)
|
|
evaluation.object.tap do |instance|
|
|
evaluation.notify(:after_build, instance)
|
|
end
|
|
end
|
|
|
|
def to_sym
|
|
:build
|
|
end
|
|
end
|
|
end
|
|
end
|