Verified Commit 1bba203a authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻
Browse files

fix group offer missing as dependent action from volunteer

parent de6ad1d1
......@@ -48,7 +48,7 @@ class Volunteer < ApplicationRecord
has_many :billing_expenses
has_many :group_assignments
has_many :group_assignments, dependent: :delete_all
has_many :group_assignment_logs
has_many :group_offers, through: :group_assignments
......
......@@ -12,7 +12,7 @@
- group_assignments.each do |group_assignment|
tr
td
= link_to_if(policy(Volunteer).show?, group_assignment.volunteer.contact.full_name, volunteer_path(group_assignment.volunteer))
= link_to_if(policy(group_assignment.volunteer).show?, group_assignment.volunteer.contact.full_name, volunteer_path(group_assignment.volunteer))
- if params[:format] == 'pdf'
td= group_assignment.volunteer.contact.primary_email
td= group_assignment.responsible ? t_attr(:responsible, GroupAssignment) : t_attr(:member, GroupAssignment)
......
......@@ -140,12 +140,14 @@ class GroupOffersTest < ApplicationSystemTestCase
assert page.has_text? title
end
test 'deleting volunteer does not crash group offer show' do
test 'deleting_volunteer_does_not_crash_group_offer_show' do
login_as create(:user)
volunteer1 = create :volunteer
volunteer2 = create :volunteer
group_offer = create :group_offer, volunteers: [volunteer1, volunteer2]
group_offer = create :group_offer
[volunteer1, volunteer2].map do |volunteer|
create(:group_assignment, volunteer: volunteer, group_offer: group_offer)
end
visit group_offer_path(group_offer)
assert page.has_link? volunteer1.contact.full_name
assert page.has_link? volunteer2.contact.full_name
......@@ -153,8 +155,8 @@ class GroupOffersTest < ApplicationSystemTestCase
Volunteer.find(volunteer1.id).destroy
visit group_offer_path(group_offer)
refute page.has_link? volunteer1.contact.full_name
assert page.has_link? volunteer2.contact.full_name
refute page.has_link? volunteer1.contact.full_name
end
test 'department_manager_has_group_assignment_select_dropdowns_in_edit_form_filled' do
......
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