Include additional test case

This commit is contained in:
Manuel Bustillo 2024-08-01 19:13:47 +02:00
parent c0aea23954
commit 0836a91498

View File

@ -125,6 +125,20 @@ module Tables
expect(calculator.send(:cohesion_penalty)).to eq(8)
end
end
context 'when the table contains six guests of three evenly split groups' do
let(:table) do
[
create_list(:guest, 2, affinity_group_list: ['family']),
create_list(:guest, 2, affinity_group_list: ['friends']),
create_list(:guest, 2, affinity_group_list: ['work'])
].flatten
end
it 'returns the sum of the penalties for each pair of guests' do
expect(calculator.send(:cohesion_penalty)).to eq(4 * 1 + 4 * Rational(1, 2) + 4 * Rational(2, 3))
end
end
end
end
end