From 263409ed919e2418c9dcc4777f70c55d1cbb6b6d Mon Sep 17 00:00:00 2001 From: Emil Tin Date: Mon, 1 Oct 2012 18:30:32 +0200 Subject: [PATCH] fix problem with meters and empty cells in tests --- features/step_definitions/routing.rb | 8 +++++--- features/testbot/origin.feature | 24 ++++++++++++------------ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/features/step_definitions/routing.rb b/features/step_definitions/routing.rb index 7b6990402..8afa9c642 100644 --- a/features/step_definitions/routing.rb +++ b/features/step_definitions/routing.rb @@ -216,11 +216,13 @@ When /^I route I should get$/ do |table| end if table.headers.include? 'route' got['route'] = (instructions || '').strip - if table.headers.include? 'distance' - raise "*** Distance must be specied in meters. (ex: 250m)" unless row['distance'] =~ /\d+m/ + if table.headers.include?('distance') + if row['distance']!='' + raise "*** Distance must be specied in meters. (ex: 250m)" unless row['distance'] =~ /\d+m/ + end got['distance'] = instructions ? json['route_summary']['total_distance'].to_s : '' end - if table.headers.include? 'time' + if table.headers.include?('time') raise "*** Time must be specied in seconds. (ex: 60s)" unless row['time'] =~ /\d+s/ got['time'] = instructions ? "#{json['route_summary']['total_time'].to_s}s" : '' end diff --git a/features/testbot/origin.feature b/features/testbot/origin.feature index c701196f5..2971cc8cf 100644 --- a/features/testbot/origin.feature +++ b/features/testbot/origin.feature @@ -17,9 +17,9 @@ Feature: Routing close to the [0,0] origin | abcd | yes | When I route I should get - | from | to | route | distance | - | b | c | abcd | 100 +-1 | - | c | b | | | + | from | to | route | distance | + | b | c | abcd | 100m +-1 | + | c | b | | | Scenario: North-south oneways close to the origin Given the node locations @@ -34,9 +34,9 @@ Feature: Routing close to the [0,0] origin | abcd | yes | When I route I should get - | from | to | route | distance | - | b | c | abcd | 100 +-1 | - | c | b | | | + | from | to | route | distance | + | b | c | abcd | 100m +-1 | + | c | b | | | Scenario: East-west oneways crossing the origin Given the node locations @@ -52,9 +52,9 @@ Feature: Routing close to the [0,0] origin | abcde | yes | When I route I should get - | from | to | route | distance | - | b | d | abcde | 200 +-1 | - | d | b | | | + | from | to | route | distance | + | b | d | abcde | 200m +-1 | + | d | b | | | Scenario: North-south oneways crossing the origin Given the node locations @@ -70,6 +70,6 @@ Feature: Routing close to the [0,0] origin | abcde | yes | When I route I should get - | from | to | route | distance | - | b | d | abcde | 200 +-1 | - | d | b | | | + | from | to | route | distance | + | b | d | abcde | 200m +-1 | + | d | b | | |