Sha256: c24481200387ebd4040938316e472aff7795256a5e815bbfef41fc0c89d0261d

Contents?: true

Size: 1.22 KB

Versions: 55

Compression:

Stored size: 1.22 KB

Contents

describe Grid do
  it 'should be empty when created' do
    # given
    expected_contents = [
      [0, 0, 0],
      [0, 0, 0]
    ]
    grid = Grid.new(2, 3)
    
    # when
    contents = grid.contents
    
    # then
    contents.should == expected_contents
  end
  
  it 'should compare equal based on its contents' do
    # given
    grid1 = Grid.new(2, 3)
    grid2 = Grid.new(2, 3)
    
    # then
    grid1.should == grid2
  end
  
  it 'should be able to replace its contents' do
    # given
    grid = Grid.new(2,2)
    new_contents = [[0,1,0], [1,0,1]]
    
    # when
    grid.contents = new_contents
    
    # then
    grid.contents.should == new_contents
    grid.rows.should == 2
    grid.columns.should == 3
  end
  
  it 'should add an organism' do
    # given
    grid = Grid.new(2, 2)
    expected = Grid.new(2, 2)
    expected.contents = [[1,0],[0,0]]
    
    # when
    grid.create_at(0,0)
    
    # then
    grid.should == expected
  end
  
  it 'should create itself from a string' do
    # given
    expected = Grid.new 3, 3
    expected.create_at(0,0)
    expected.create_at(1,0)
    expected.create_at(2,2)
    
    # when
    actual = Grid.from_string "X.. X.. ..X"
    
    # then
    actual.should == expected
  end
end

Version data entries

55 entries across 55 versions & 10 rubygems

Version Path
dchelimsky-rspec-1.1.10 examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
jnstq-acts_as_sms-0.1.0 test/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
jnstq-acts_as_sms-0.1.1 test/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
jnstq-acts_as_sms-0.1.3 test/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
jnstq-acts_as_sms-0.1.4 test/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
merb-core-1.1.3 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
merb-core-1.1.2 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
merb-core-1.1.1 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
merb-core-1.1.0 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
merb-core-1.1.0.rc1 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
merb-core-1.1.0.pre spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
deckshuffler-0.0.2 vendor/plugins/rspec/examples/story/game-of-life/behaviour/examples/grid_behaviour.rb
picolena-0.0.99 app_generators/picolena/templates/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
picolena-0.1.1 rails_plugins/rspec/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
picolena-0.1.0 rails_plugins/rspec/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
picolena-0.1.3 rails_plugins/rspec/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
picolena-0.1.4 rails_plugins/rspec/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
picolena-0.1.2 rails_plugins/rspec/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
picolena-0.1.5 rails_plugins/rspec/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
pictrails-0.5.0 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb