Verified Commit 4b32c14f authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻
Browse files

simpler conditional assignment in factory

parent 437d98e8
Pipeline #18809 passed with stage
in 36 minutes and 49 seconds
......@@ -18,16 +18,12 @@ FactoryBot.define do
termination_verified_at { 2.days.ago }
association :period_end_set_by, factory: :user
after(:build) do |group_assignment|
if group_assignment.volunteer.blank?
group_assignment.volunteer = create(:volunteer_with_user)
end
group_assignment.volunteer ||= create(:volunteer_with_user)
group_assignment.termination_submitted_by = group_assignment.volunteer.user
group_assignment.termination_verified_by = group_assignment.period_end_set_by
group_assignment.group_offer = create(:group_offer) if group_assignment.group_offer.blank?
end
after(:create) do |group_assignment|
group_assignment.create_log_of_self
group_assignment.group_offer ||= create(:group_offer)
end
after(:create, &:create_log_of_self)
end
end
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment