require 'rails_helper' RSpec.describe Table, type: :model do before :all do @table = FactoryGirl.create(:table) end subject { @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 match Seat::ActiveRecord_Associations_CollectionProxy end it '#users returns Users collection' do expect(@table.users.class).to match User::ActiveRecord_Associations_CollectionProxy end it '#games returns Games collection' do expect(@table.games.class).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