~ubuntu-branches/ubuntu/oneiric/puppet/oneiric-security

« back to all changes in this revision

Viewing changes to vendor/gems/rspec/examples/stories/game-of-life/behaviour/examples/game_behaviour.rb

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Pollock
  • Date: 2009-04-13 17:12:47 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (3.1.3 squeeze) (1.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: james.westby@ubuntu.com-20090413171247-61zlnwi5esw1lhtv
ImportĀ upstreamĀ versionĀ 0.24.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
require 'life'
2
 
 
3
 
describe 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
35
 
end