diff --git a/features/step_definitions/routing.rb b/features/step_definitions/routing.rb index e35a8e89458..44e4bfd10ec 100644 --- a/features/step_definitions/routing.rb +++ b/features/step_definitions/routing.rb @@ -157,24 +157,29 @@ def computed_route table.hashes.each_with_index do |row,i| got = row.dup attempts = [] - if table.headers.include? 'forw' - response = request_route("#{ORIGIN[1]},#{ORIGIN[0]+(1+WAY_SPACING*i)*ZOOM}","#{ORIGIN[1]},#{ORIGIN[0]+(2+WAY_SPACING*i)*ZOOM}") - got['forw'] = route_status response - if got['forw'] != row['forw'] + row['way'] = "w#{i}" + got['way'] = "w#{i}" + ['forw','backw'].each do |direction| + if table.headers.include? direction + if direction == 'forw' + response = request_route("#{ORIGIN[1]},#{ORIGIN[0]+(1+WAY_SPACING*i)*@zoom}","#{ORIGIN[1]},#{ORIGIN[0]+(2+WAY_SPACING*i)*@zoom}") + elsif direction == 'backw' + response = request_route("#{ORIGIN[1]},#{ORIGIN[0]+(2+WAY_SPACING*i)*@zoom}","#{ORIGIN[1]},#{ORIGIN[0]+(1+WAY_SPACING*i)*@zoom}") + end + got[direction] = route_status response json = JSON.parse(response.body) - attempts << { :attempt => 'Forward', :query => @query, :response => response } + if got[direction] == 'x' + route = way_list json['route_instructions'] + if route != "w#{i}" + got[direction] = "#{route}?" + end + end + if got[direction] != row[direction] + attempts << { :attempt => direction, :query => @query, :response => response } + end end end - if table.headers.include? 'backw' - response = request_route("#{ORIGIN[1]},#{ORIGIN[0]+(2+WAY_SPACING*i)*ZOOM}","#{ORIGIN[1]},#{ORIGIN[0]+(1+WAY_SPACING*i)*ZOOM}") - got['backw'] = route_status response - if got['backw'] != row['backw'] - attempts << { :attempt => 'Backward', :query => @query, :response => response } - end - end - if got != row - log_fail row,got,attempts - end + log_fail row,got,attempts if got != row actual << got end end diff --git a/features/support/data.rb b/features/support/data.rb index 140d2ec72f7..63fcec13e21 100644 --- a/features/support/data.rb +++ b/features/support/data.rb @@ -56,7 +56,7 @@ def build_ways_from_table table tags = row.dup tags.delete 'forw' tags.delete 'backw' - tags['name'] = "abcd#{ri}" + tags['name'] = "w#{ri}" tags.reject! { |k,v| v=='' } way << tags osm_db << way