aboutsummaryrefslogtreecommitdiffstats
path: root/spec/board_spec.rb
diff options
context:
space:
mode:
authorTeddy Wing2015-04-14 18:39:07 -0400
committerTeddy Wing2015-04-14 18:39:07 -0400
commit07885399cb161c38244a9c8a564939c7b98bf4ba (patch)
treeb9b3ce1e4917169ca07608da99bc9c1cfbc074e5 /spec/board_spec.rb
parenta9698b70d47e5c4914d27b38baccd9feec8479a8 (diff)
downloadtic-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.rb25
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