Verified Commit 2192517f authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻
Browse files

add factory for terminated group offer and group_assignment

parent f09ce619
......@@ -11,5 +11,23 @@ FactoryBot.define do
group_assignment.volunteer = create(:volunteer_with_user) if group_assignment.volunteer.blank?
group_assignment.group_offer = create(:group_offer) if group_assignment.group_offer.blank?
end
factory :terminated_group_assignment do
period_end { 4.days.ago }
termination_submitted_at { 3.days.ago }
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.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
end
end
end
end
......@@ -21,5 +21,11 @@ FactoryBot.define do
location { FFaker::Address.city }
organization { FFaker::Company.name }
end
trait :terminated do
period_end { 2.days.ago }
association :period_end_set_by, factory: :user
active { false }
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