From e1ac1c4fdc062a0e5c017d268d0a7fcb25bbbab1 Mon Sep 17 00:00:00 2001 From: Freenerd Date: Fri, 18 Sep 2015 17:30:53 +0200 Subject: [PATCH] Test that alternative route exists Complement to a6b44a14709bf760425cfef288d1f14a6914f569 --- features/step_definitions/routing.rb | 4 ++++ features/testbot/via.feature | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/features/step_definitions/routing.rb b/features/step_definitions/routing.rb index 6a73d8604..21fcf489a 100644 --- a/features/step_definitions/routing.rb +++ b/features/step_definitions/routing.rb @@ -82,6 +82,10 @@ When /^I route I should get$/ do |table| end if table.headers.include? 'route' got['route'] = (instructions || '').strip + if table.headers.include?('alternative') + raise "*** No alternative found ***" unless json['found_alternative'] + got['alternative'] = way_list json['alternative_instructions'].first + end if table.headers.include?('distance') if row['distance']!='' raise "*** Distance must be specied in meters. (ex: 250m)" unless row['distance'] =~ /\d+m/ diff --git a/features/testbot/via.feature b/features/testbot/via.feature index a70ee9f7f..393e1d052 100644 --- a/features/testbot/via.feature +++ b/features/testbot/via.feature @@ -52,6 +52,31 @@ Feature: Via points | a,c,f | ab,bcd,bcd,de,efg | | a,c,f,h | ab,bcd,bcd,de,efg,efg,gh | + Scenario: Alternative via points + Given the node map + | | b | c | d | | | + | a | | | | | z | + | | g | h | i | j | | + + And the ways + | nodes | + | ab | + | bc | + | cd | + | dz | + | ag | + | gh | + | hi | + | ij | + | jz | + + And the query options + | alt | true | + + When I route I should get + | waypoints | route | alternative | + | a,z | ab,bc,cd,dz | ag,gh,hi,ij,jz | + Scenario: Duplicate via point Given the node map | x | | | | | |