Refactor alternative route test

This commit is contained in:
Freenerd 2015-09-22 11:46:00 +02:00 committed by Patrick Niklaus
parent 9deadc1371
commit 55cad1b3ac
3 changed files with 44 additions and 26 deletions

View File

@ -83,8 +83,12 @@ When /^I route I should get$/ do |table|
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
got['alternative'] =
if json['found_alternative']
way_list json['alternative_instructions'].first
else
""
end
end
if table.headers.include?('distance')
if row['distance']!=''

View File

@ -0,0 +1,38 @@
@routing @testbot @alternative
Feature: Alternative route
Background:
Given the profile "testbot"
And 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 |
Scenario: Enabled alternative
Given the query options
| alt | true |
When I route I should get
| from | to | route | alternative |
| a | z | ab,bc,cd,dz | ag,gh,hi,ij,jz |
Scenario: Disabled alternative
Given the query options
| alt | false |
When I route I should get
| from | to | route | alternative |
| a | z | ab,bc,cd,dz | |

View File

@ -52,30 +52,6 @@ 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