Fix game tests
This commit is contained in:
parent
7b5c67e0e4
commit
08bcaf8fba
@ -2,7 +2,8 @@ require 'rails_helper'
|
||||
|
||||
RSpec.describe Game, type: :model do
|
||||
before(:each) do
|
||||
@game = FactoryGirl.create(:game)
|
||||
@table = FactoryGirl.create :table
|
||||
@game = @table.current_game
|
||||
@user1 = FactoryGirl.create(:user)
|
||||
@user2 = FactoryGirl.create(:user)
|
||||
end
|
||||
@ -13,10 +14,6 @@ RSpec.describe Game, type: :model do
|
||||
it { should respond_to(:play_to_beat) }
|
||||
it { should respond_to(:winner) }
|
||||
|
||||
it '#title returns a string' do
|
||||
expect(@game.title).to match 'Test Game'
|
||||
end
|
||||
|
||||
it 'has a winner' do
|
||||
# Start the game
|
||||
@player1 = @user1.sit_in(@game.seats.first)
|
||||
@ -29,6 +26,7 @@ RSpec.describe Game, type: :model do
|
||||
@player.play_hand [card]
|
||||
@game.reload
|
||||
while (@game.controlling_player != @player) do
|
||||
break if @game.over?
|
||||
@game.controlling_player.pass
|
||||
@game.reload
|
||||
end
|
||||
@ -67,7 +65,6 @@ RSpec.describe Game, type: :model do
|
||||
@game.players.new(user_id: User.last.id)
|
||||
expect { @game.validate_startable }.to raise_error StandardError
|
||||
expect(@game.startable?).to eq(false)
|
||||
binding.pry
|
||||
expect(@game.errors[:players])
|
||||
.to include 'Must be less than 5 players.'
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user