WIP specs
This commit is contained in:
parent
4193cc4d6d
commit
e3ce152496
@ -2,5 +2,32 @@ require 'rails_helper'
|
||||
|
||||
module Tables
|
||||
RSpec.describe Shift do
|
||||
describe '#each' do
|
||||
let(:shifts) do
|
||||
acc = []
|
||||
described_class.new(initial_solution).each do |solution|
|
||||
acc << solution.tables.map(&:dup)
|
||||
end
|
||||
acc
|
||||
end
|
||||
|
||||
context 'when there are two tables with two people each' do
|
||||
let(:initial_solution) do
|
||||
Distribution.new(min_per_table: 2, max_per_table: 2).tap do |distribution|
|
||||
distribution.tables << %i[a b].to_table
|
||||
distribution.tables << %i[c d].to_table
|
||||
end
|
||||
end
|
||||
|
||||
it 'yields all possible shifts between the tables' do
|
||||
expect(shifts).to contain_exactly(
|
||||
[[:b], %i[c d a]],
|
||||
[[:a], %i[c d b]],
|
||||
[%i[b a d], [:c]],
|
||||
[%i[b a c], [:d]]
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user