fix problem with meters and empty cells in tests

This commit is contained in:
Emil Tin 2012-10-01 18:30:32 +02:00
parent 7610af3378
commit 263409ed91
2 changed files with 17 additions and 15 deletions

View File

@ -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'
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

View File

@ -18,7 +18,7 @@ Feature: Routing close to the [0,0] origin
When I route I should get
| from | to | route | distance |
| b | c | abcd | 100 +-1 |
| b | c | abcd | 100m +-1 |
| c | b | | |
Scenario: North-south oneways close to the origin
@ -35,7 +35,7 @@ Feature: Routing close to the [0,0] origin
When I route I should get
| from | to | route | distance |
| b | c | abcd | 100 +-1 |
| b | c | abcd | 100m +-1 |
| c | b | | |
Scenario: East-west oneways crossing the origin
@ -53,7 +53,7 @@ Feature: Routing close to the [0,0] origin
When I route I should get
| from | to | route | distance |
| b | d | abcde | 200 +-1 |
| b | d | abcde | 200m +-1 |
| d | b | | |
Scenario: North-south oneways crossing the origin
@ -71,5 +71,5 @@ Feature: Routing close to the [0,0] origin
When I route I should get
| from | to | route | distance |
| b | d | abcde | 200 +-1 |
| b | d | abcde | 200m +-1 |
| d | b | | |