allow setting origin in cuke tests

This commit is contained in:
Emil Tin
2013-08-31 23:35:26 +02:00
parent caa02bbca1
commit 3cf72e93e6
4 changed files with 20 additions and 11 deletions
+4
View File
@@ -6,6 +6,10 @@ Given /^a grid size of (\d+) meters$/ do |meters|
set_grid_size meters
end
Given /^the origin lat\/lon (\d+),(\d+)$/ do |lat,lon|
set_origin [lon.to_f,lat.to_f]
end
Given /^the shortcuts$/ do |table|
table.hashes.each do |row|
shortcuts_hash[ row['key'] ] = row['value']
+4 -4
View File
@@ -12,12 +12,12 @@ Then /^routability should be$/ do |table|
['forw','backw','bothw'].each do |direction|
if table.headers.include? direction
if direction == 'forw' || direction == 'bothw'
a = Location.new ORIGIN[0]+(1+WAY_SPACING*i)*@zoom, ORIGIN[1]
b = Location.new ORIGIN[0]+(3+WAY_SPACING*i)*@zoom, ORIGIN[1]
a = Location.new @origin[0]+(1+WAY_SPACING*i)*@zoom, @origin[1]
b = Location.new @origin[0]+(3+WAY_SPACING*i)*@zoom, @origin[1]
response = request_route [a,b]
elsif direction == 'backw' || direction == 'bothw'
a = Location.new ORIGIN[0]+(3+WAY_SPACING*i)*@zoom, ORIGIN[1]
b = Location.new ORIGIN[0]+(1+WAY_SPACING*i)*@zoom, ORIGIN[1]
a = Location.new @origin[0]+(3+WAY_SPACING*i)*@zoom, @origin[1]
b = Location.new @origin[0]+(1+WAY_SPACING*i)*@zoom, @origin[1]
response = request_route [a,b]
end
want = shortcuts_hash[row[direction]] || row[direction] #expand shortcuts