|
38 | 38 |
|
39 | 39 | expect(page).to have_select('feedback_tutorial_id', with_options: [@tutorial.title]) |
40 | 40 | end |
| 41 | + |
| 42 | + scenario 'I can see coaches who RSVPd but have not yet been marked as attended (Issue #2367)' do |
| 43 | + # This reproduces the real-world scenario where: |
| 44 | + # 1. Coach RSVPs to workshop (attending = true) |
| 45 | + # 2. Feedback is sent the next day |
| 46 | + # 3. Organizer hasn't yet marked attendance (attended = nil) |
| 47 | + coach_not_yet_verified = Fabricate(:coach) |
| 48 | + Fabricate(:attending_workshop_invitation, |
| 49 | + workshop: feedback_request.workshop, |
| 50 | + member: coach_not_yet_verified, |
| 51 | + role: 'Coach', |
| 52 | + attended: nil) |
| 53 | + |
| 54 | + visit feedback_path(valid_token) |
| 55 | + |
| 56 | + # Coach should appear in the list even though attended is nil |
| 57 | + expect(page).to have_select('feedback_coach_id', with_options: [coach_not_yet_verified.full_name]) |
| 58 | + end |
| 59 | + |
| 60 | + scenario 'verified coaches appear before unverified coaches in the list' do |
| 61 | + # Create two coaches: one verified (attended=true), one not yet (attended=nil) |
| 62 | + verified_coach = Fabricate(:coach, name: 'Alice', surname: 'Verified') |
| 63 | + unverified_coach = Fabricate(:coach, name: 'Bob', surname: 'Unverified') |
| 64 | + |
| 65 | + Fabricate(:attended_workshop_invitation, |
| 66 | + workshop: feedback_request.workshop, |
| 67 | + member: verified_coach, |
| 68 | + role: 'Coach') |
| 69 | + |
| 70 | + Fabricate(:attending_workshop_invitation, |
| 71 | + workshop: feedback_request.workshop, |
| 72 | + member: unverified_coach, |
| 73 | + role: 'Coach', |
| 74 | + attended: nil) |
| 75 | + |
| 76 | + visit feedback_path(valid_token) |
| 77 | + |
| 78 | + # Get all coach options in order |
| 79 | + select_options = page.find('#feedback_coach_id').all('option').map(&:text).reject(&:blank?) |
| 80 | + verified_index = select_options.index(verified_coach.full_name) |
| 81 | + unverified_index = select_options.index(unverified_coach.full_name) |
| 82 | + |
| 83 | + # Verified coach should appear before unverified coach |
| 84 | + expect(verified_index).to be < unverified_index |
| 85 | + end |
41 | 86 | end |
42 | 87 |
|
43 | 88 | context 'I get redirected to the main page' do |
|
0 commit comments