Commit 25c79d4

mo k <mo@mokhan.ca>
2012-08-12 23:58:57
update the cucumber steps.
1 parent 4a547bf
Changed files (1)
features
step_definitions
features/step_definitions/navigation_steps.rb
@@ -2,29 +2,21 @@ $:.unshift(File.dirname(__FILE__) + '/../../spec')
 require 'spec_helper'
 
 Given /the plateau is (\d+) by (\d+)/ do |x,y|
-  @terrain = Terrain.new({:x => x, :y => y})
+  @plateau = "#{x} #{y}"
 end
 
-Given "the starting position is '(\d+) (\d+) N'" do |x,y|
-  @rover = @terrain.deploy_rover_to('N', {:x => x, :y => y})
+Given "the starting position is '(\d+) (\d+) (.*)'" do |x,y, heading|
+  @rover = "#{x} #{y} #{heading}"
 end
 
 Given /I move '(.*)'/ do |instructions|
-  instructions.split(//).each do |instruction|
-    case(instruction)
-    when 'M'
-      @rover.move_forward(terrain)
-    when 'R'
-      @rover.turn_right
-    when 'L'
-      @rover.turn_left
-    end
-  end
+  @instructions = instructions
 end
 
 When /I tell the rover to travel/ do |op|
+  @command = NavigateRover.new(@plateau, @landing, @instructions)
 end
 
 Then /the result should be '1 3 N' on the screen/ do
-  @rover.to_s.should == '1 3 N'
+  @command.run.should == '1 3 N'
 end