970c3e4b2b
Calling business logic in a factory is a code-smell, because it usually requires the object to be saved into database, and may have unintended consequences when the business logic is changed. Also, this allows to just build a published procedure, without saving it to the database.
16 lines
419 B
Ruby
16 lines
419 B
Ruby
FactoryBot.define do
|
|
factory :procedure_revision_type_de_champ do
|
|
transient do
|
|
from_original { nil }
|
|
end
|
|
|
|
after(:build) do |revision_type_de_champ, evaluator|
|
|
if evaluator.from_original
|
|
original = evaluator.from_original
|
|
|
|
revision_type_de_champ.type_de_champ = original.type_de_champ
|
|
revision_type_de_champ.position = original.position
|
|
end
|
|
end
|
|
end
|
|
end
|