diff options
Diffstat (limited to 'spec')
| -rwxr-xr-x[-rw-r--r--] | spec/rover_specs.rb | 1 | ||||
| -rwxr-xr-x | spec/south_specs.rb | 31 | ||||
| -rwxr-xr-x[-rw-r--r--] | spec/ts_all.rb | 1 |
3 files changed, 33 insertions, 0 deletions
diff --git a/spec/rover_specs.rb b/spec/rover_specs.rb index 52b45c3..f8d15f8 100644..100755 --- a/spec/rover_specs.rb +++ b/spec/rover_specs.rb @@ -55,6 +55,7 @@ describe Rover do end describe "when driving forward" do before do + @terrain = fake @sut.move_forward(@terrain) end it "should decrement the y coordinate on the terrain" do diff --git a/spec/south_specs.rb b/spec/south_specs.rb new file mode 100755 index 0000000..7d3fc33 --- /dev/null +++ b/spec/south_specs.rb @@ -0,0 +1,31 @@ +require 'south'
+
+describe South do
+ before do
+ @sut = South.new
+ end
+ describe "when driving forward" do
+ describe "when at the edge of the terrain" do
+ it "should not move forward" do
+ @location[:y].must_equal 1
+ end
+ before do
+ @location = {:x => 0, :y => 1}
+ @terrain = fake
+ @terrain.stub(:is_out_of_bounds).with({:x => 0, :y => 0}).and_return(true);
+ @sut.forward(@location, @terrain)
+ end
+ end
+ describe "when it is ok to move forward" do
+ it "should move forward" do
+ @location[:y].must_equal 0
+ end
+ before do
+ @location = {:x => 0, :y => 1}
+ @terrain = fake
+ @terrain.stub(:is_out_of_bounds).with({:x => 0, :y => 0}).and_return(false);
+ @sut.forward(@location, @terrain)
+ end
+ end
+ end
+end
diff --git a/spec/ts_all.rb b/spec/ts_all.rb index b783a1e..36e285f 100644..100755 --- a/spec/ts_all.rb +++ b/spec/ts_all.rb @@ -8,4 +8,5 @@ require "library_specs" require "stack_specs" require "rover_specs" require "north_specs" +require "south_specs" require "specifications/find_all_books_by_author_specs" |
