Commit b956da2

mo khan <mo@mokhan.ca>
2014-06-21 21:13:59
begin the world.
1 parent 3d2a6da
Changed files (1)
spec/world_spec.rb
@@ -6,6 +6,12 @@ class World
   def neighbors_for(cell)
     @cells.find_all { |x| cell.neighbor?(x) }
   end
+
+  def begin
+    @cells.each do |cell|
+      cell.spawn(self)
+    end
+  end
 end
 
 describe World do
@@ -30,4 +36,14 @@ describe World do
       expect(subject.neighbors_for(cell)).to_not include(other_cell)
     end
   end
+
+  context "begin" do
+    subject { World.new([cell]) }
+    let(:cell) { double(spawn: true) }
+
+    it "visits each cell" do
+      subject.begin
+      expect(cell).to have_received(:spawn).with(subject)
+    end
+  end
 end