changelog shortlog tags changeset manifest revisions annotate raw

vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/game_behaviour.rb

changeset 15: 64acf98d15f4
author: moriq@moriq.com
date: Mon Mar 10 10:12:58 2008 +0900 (16 years ago)
permissions: -rw-r--r--
description: add plugins rspec
1require 'life'
2
3describe Game do
4 it 'should have a grid' do
5 # given
6 game = Game.new(5, 5)
7
8 # then
9 game.grid.should be_kind_of(Grid)
10 end
11
12 it 'should create a cell' do
13 # given
14 game = Game.new(2, 2)
15 expected_grid = Grid.from_string( 'X. ..' )
16
17 # when
18 game.create_at(0, 0)
19
20 # then
21 game.grid.should == expected_grid
22 end
23
24 it 'should destroy a cell' do
25 # given
26 game = Game.new(2,2)
27 game.grid = Grid.from_string('X. ..')
28
29 # when
30 game.destroy_at(0,0)
31
32 # then
33 game.grid.should == Grid.from_string('.. ..')
34 end
35end