Created
September 28, 2012 17:00
-
-
Save jszmajda/3800974 to your computer and use it in GitHub Desktop.
Evil ping-pong pairing is fun
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe World do | |
it "should return no cell on a new board" do | |
w = World.new | |
w.cell_at(2,2).should be_nil | |
end | |
it "should allow cell creation" do | |
w = World.new | |
w.make_cell(2,2) | |
w.cell_at(2,2).should be_kind_of(Cell) | |
end | |
end | |
class World | |
def initialize | |
@calls =0 | |
end | |
def cell_at(x,y) | |
return nil if @calls == 0 | |
Cell.new | |
end | |
def make_cell(x,y) | |
@calls += 1 | |
Cell.new | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment