Skip to content

Commit

Permalink
delete or modify slow integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
IanDCarroll committed Jul 10, 2017
1 parent 724615c commit 1f9bac3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 47 deletions.
10 changes: 8 additions & 2 deletions spec/ai/computer_player_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@
board: [ nil, nil, nil,
nil, nil, nil,
nil, nil, nil ] } }
Given(:computer) { ComputerPlayer.new(Board.new) }
Given(:board) { Board.new }
Given(:computer) { ComputerPlayer.new(board) }
When { board.mark(1,"X")
board.mark(4,"O")
board.mark(3,"X")
board.mark(2,"O")
board.mark(5,"X") }
When(:pulled_move) { computer.pull_move }
Then { 4 == pulled_move }
Then { 0 == pulled_move }
end
end
30 changes: 0 additions & 30 deletions spec/ai/minimax_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -413,34 +413,4 @@
Then { 2 == minimax.optimum_choice }
And { {0=>-1, 1=>-1, 2=>0, 3=>-1, 6=>0, 8=>0} == minimax.choices }
end

context 'when X takes the center' do
Given(:board) { Board.new }
Given(:minimax) { Minimax.new(board) }
When { board.mark(4, "X") }
Then { 0 == minimax.optimum_choice }
And { {0=>0, 1=>-1, 2=>0,
3=>-1, 5=>-1,
6=>0, 7=>-1, 8=>0} == minimax.choices }
end

context 'when X takes a corner' do
Given(:board) { Board.new }
Given(:minimax) { Minimax.new(board) }
When { board.mark(0, "X") }
Then { 4 == minimax.optimum_choice }
And { { 1=>-1, 2=>-1,
3=>-1, 4=>0, 5=>-1,
6=>-1, 7=>-1, 8=>-1} == minimax.choices }
end

context 'when X takes a side' do
Given(:board) { Board.new }
Given(:minimax) { Minimax.new(board) }
When { board.mark(1, "X") }
Then { 0 == minimax.optimum_choice }
And { {0=> 0, 2=> 0,
3=>-1, 4=> 0, 5=>-1,
6=>-1, 7=> 0, 8=>-1} == minimax.choices }
end
end
15 changes: 0 additions & 15 deletions spec/game_runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,18 +167,3 @@
Then { nil == start_game }
end
end

describe 'GameRunner make_a_move' do
context 'when the AI goes second' do
Given(:board) { Board.new }
Given(:adapter) { Adapter.new(MockShell.new) }
Given(:ai) { ComputerPlayer.new(board) }
Given(:game_runner) { GameRunner.new(board, Rules.new(board), adapter) }
When(:make_a_move) { game_runner.play(ai.pull_move)
game_runner.make_a_move }
Then{ { message: ["O", 0],
board: ["O", nil, nil,
nil, "X", nil,
nil, nil, nil] } == make_a_move }
end
end

0 comments on commit 1f9bac3

Please sign in to comment.