2021-11-08 21:49:31 -08:00

35 lines
968 B
Ruby

RSpec.describe Table, type: :model do
let(:table) { FactoryGirl.create(:table) }
it { should respond_to :title }
it { should respond_to :seats }
it { should respond_to :users }
it { should respond_to :games }
it { should respond_to :current_game }
it '#title returns a string' do
expect(table.title).to match 'Test Table'
end
it '#seats returns Seats collection' do
expect(table.seats.class.to_s).to match "Seat::ActiveRecord_Associations_CollectionProxy"
end
it '#users returns Users collection' do
expect(table.users.class.to_s).to match "User::ActiveRecord_Associations_CollectionProxy"
end
it '#games returns Games collection' do
expect(table.games.class.to_s).to match "Game::ActiveRecord_Associations_CollectionProxy"
end
it '#current_game returns a Game' do
expect(table.current_game.class).to match Game
end
it "#seats returns 4 seats by default" do
expect(table.seats.count).to eq 4
end
end