diff options
| author | mo k <mo@mokhan.ca> | 2012-02-13 16:21:57 -0700 |
|---|---|---|
| committer | mo k <mo@mokhan.ca> | 2012-02-13 16:21:57 -0700 |
| commit | ec2cb99c0e3eed4bd704cbbfc7f3af1368f4ac3a (patch) | |
| tree | f0f7b468cd048137532cb0535707cebb30f1d0d7 /spec | |
| parent | 86fda8f9ff0eb0bd32f67c5d2bbdae0ec5b6033c (diff) | |
prevent falling off the map when on the edge and facing east.
Diffstat (limited to 'spec')
| -rwxr-xr-x | spec/east_specs.rb | 20 | ||||
| -rwxr-xr-x | spec/rover_specs.rb | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/spec/east_specs.rb b/spec/east_specs.rb new file mode 100755 index 0000000..5060956 --- /dev/null +++ b/spec/east_specs.rb @@ -0,0 +1,20 @@ +require 'east'
+
+describe East do
+ before(:each) do
+ @sut = East.new
+ end
+ describe "when at the edge of the terrain" do
+ describe "when moving forward" do
+ it "should just stay at the current position" do
+ @location[:x].must_equal 0
+ end
+ before do
+ terrain = fake
+ terrain.stub(:is_out_of_bounds).with({:x => -1, :y => 0}).and_return(true)
+ @location = {:x => 0, :y => 0}
+ @sut.forward(@location, terrain)
+ end
+ end
+ end
+end
diff --git a/spec/rover_specs.rb b/spec/rover_specs.rb index f8d15f8..8c3da03 100755 --- a/spec/rover_specs.rb +++ b/spec/rover_specs.rb @@ -82,6 +82,7 @@ describe Rover do end describe "when driving forward" do before do + @terrain = fake @sut.move_forward(@terrain) end it "should increment the x coordinate on the terrain" do |
