diff options
| author | Teddy Wing | 2015-04-14 18:39:07 -0400 |
|---|---|---|
| committer | Teddy Wing | 2015-04-14 18:39:07 -0400 |
| commit | 07885399cb161c38244a9c8a564939c7b98bf4ba (patch) | |
| tree | b9b3ce1e4917169ca07608da99bc9c1cfbc074e5 /spec/board_spec.rb | |
| parent | a9698b70d47e5c4914d27b38baccd9feec8479a8 (diff) | |
| download | tic-tac-toe-07885399cb161c38244a9c8a564939c7b98bf4ba.tar.bz2 | |
Board: Fix #render method
Return the actual board in the right format instead of always returning
3 rows of 3 dots.
Diffstat (limited to 'spec/board_spec.rb')
| -rw-r--r-- | spec/board_spec.rb | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/spec/board_spec.rb b/spec/board_spec.rb index a5c45ef..ae1bdd0 100644 --- a/spec/board_spec.rb +++ b/spec/board_spec.rb @@ -6,8 +6,16 @@ describe Board do @board = Board.new end + it 'starts with a grid of dots' do + @board.instance_variable_get('@board').must_equal [ + ['.', '.', '.'], + ['.', '.', '.'], + ['.', '.', '.'] + ] + end + describe '#render' do - it 'prints a grid' do + it 'must be a grid' do @board.render.must_equal <<EOF ... ... @@ -15,12 +23,17 @@ describe Board do EOF end - it 'starts with a grid of dots' do - @board.instance_variable_get('@board').must_equal [ - ['.', '.', '.'], + it 'must be the correct board' do + @board.instance_variable_set(:@board, [ + ['.', 'X', 'O'], + ['X', '.', '.'], ['.', '.', '.'], - ['.', '.', '.'] - ] + ]) + @board.render.must_equal <<EOF +.XO +X.. +... +EOF end end |
