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
+5 -3
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'
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