Skip to content

Commit d9e5744

Browse files
committed
Fix flaky test: Update banned members test for reduced member count
The group fabricator now creates 2 members per group instead of 5, so chapter_with_groups creates 4 total members (2 students + 2 coaches). Updated the test to work with 4 members instead of 10.
1 parent 0bc764b commit d9e5744

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

spec/features/admin/meeting_spec.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,17 @@
106106
scenario 'does not send the invitations to banned members' do
107107
chapter = Fabricate(:chapter_with_groups)
108108
meeting = Fabricate(:meeting, chapters: [chapter])
109-
chapter.members[1..2].each do |member|
109+
# With 4 total members (2 students + 2 coaches), ban 2 active, 1 expired
110+
# Expected: 4 total - 2 active bans = 2 emails sent
111+
chapter.members[0..1].each do |member|
110112
Fabricate(:ban, member: member)
111113
end
112-
permanent_ban = Fabricate.build(:ban, member: chapter.members[3], permanent: true, expires_at: nil)
113-
permanent_ban.save(validate: false)
114-
Fabricate(:ban, member: chapter.members[4], expires_at: Time.zone.today + 2.months)
115-
expired_ban = Fabricate.build(:ban, member: chapter.members[5], expires_at: Time.zone.today - 1.month)
114+
expired_ban = Fabricate.build(:ban, member: chapter.members[2], expires_at: Time.zone.today - 1.month)
116115
expired_ban.save(validate: false)
117116

118117
expect do
119118
visit invite_admin_meeting_path(meeting)
120-
end.to change { ActionMailer::Base.deliveries.count }.by(chapter.members.count - 4)
119+
end.to change { ActionMailer::Base.deliveries.count }.by(2)
121120
end
122121
end
123122
end

0 commit comments

Comments
 (0)