Some checks failed
		
		
	
	Run unit tests / copyright_notice (pull_request) Successful in 1m50s
				
			Run unit tests / rubocop (pull_request) Failing after 2m12s
				
			Run unit tests / check-licenses (pull_request) Successful in 2m50s
				
			Run unit tests / unit_tests (pull_request) Successful in 3m48s
				
			Run unit tests / build-static-assets (pull_request) Successful in 1h45m6s
				
			
		
			
				
	
	
		
			29 lines
		
	
	
		
			925 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			925 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| # Copyright (C) 2024-2025 LibreWeddingPlanner contributors
 | |
| 
 | |
| # frozen_string_literal: true
 | |
| 
 | |
| require 'rails_helper'
 | |
| 
 | |
| module Tables
 | |
|   RSpec.describe WheelSwap do
 | |
|     context 'when the solution has three tables' do
 | |
|       let(:initial_solution) do
 | |
|         Distribution.new(min_per_table: 3, max_per_table: 3, tables_arrangement_id: nil).tap do |distribution|
 | |
|           distribution.tables << Set[:a, :b, :c].to_table
 | |
|           distribution.tables << Set[:d, :e, :f].to_table
 | |
|           distribution.tables << Set[:g, :h, :i].to_table
 | |
|         end
 | |
|       end
 | |
| 
 | |
|       it 'swaps a random guest from each table with a guest from another table', :aggregate_failures do
 | |
|         result = described_class.new(initial_solution).call
 | |
| 
 | |
|         expect(result.tables.size).to eq(3)
 | |
|         expect(result.tables.map(&:size)).to all(eq(3))
 | |
| 
 | |
|         expect(result.tables.map(&:to_a).flatten).to match_array((:a..:i).to_a)
 | |
|       end
 | |
|     end
 | |
|   end
 | |
| end
 |