X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/ddd5b4cf19a92582fd114914be5bd5a04d3522a7..3f607d565bc0e2c7b1b738301c11c16d069913d5:/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/examples/game_behaviour.rb diff --git a/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/examples/game_behaviour.rb b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/examples/game_behaviour.rb new file mode 100644 index 000000000..ff5b357f0 --- /dev/null +++ b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/examples/game_behaviour.rb @@ -0,0 +1,35 @@ +require 'life' + +describe Game do + it 'should have a grid' do + # given + game = Game.new(5, 5) + + # then + game.grid.should be_kind_of(Grid) + end + + it 'should create a cell' do + # given + game = Game.new(2, 2) + expected_grid = Grid.from_string( 'X. ..' ) + + # when + game.create_at(0, 0) + + # then + game.grid.should == expected_grid + end + + it 'should destroy a cell' do + # given + game = Game.new(2,2) + game.grid = Grid.from_string('X. ..') + + # when + game.destroy_at(0,0) + + # then + game.grid.should == Grid.from_string('.. ..') + end +end