Skip to content

Instantly share code, notes, and snippets.

@justinxreese
Forked from jszmajda/gist:3800974
Last active August 29, 2015 14:24
Show Gist options
  • Save justinxreese/9c1c4c1a84d9a7605a4b to your computer and use it in GitHub Desktop.
Save justinxreese/9c1c4c1a84d9a7605a4b to your computer and use it in GitHub Desktop.
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