-
-
Save justinxreese/9c1c4c1a84d9a7605a4b to your computer and use it in GitHub Desktop.
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