removing trailing whitespace in cuke/ruby files
This commit is contained in:
@@ -35,9 +35,9 @@ Given /^the node locations$/ do |table|
|
||||
name = row['node']
|
||||
raise "*** duplicate node '#{name}'" if find_node_by_name name
|
||||
if name.match /[a-z]/
|
||||
add_osm_node name, row['lon'].to_f, row['lat'].to_f
|
||||
add_osm_node name, row['lon'].to_f, row['lat'].to_f
|
||||
else
|
||||
add_location name, row['lon'].to_f, row['lat'].to_f
|
||||
add_location name, row['lon'].to_f, row['lat'].to_f
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -55,7 +55,7 @@ Given /^the ways$/ do |table|
|
||||
table.hashes.each do |row|
|
||||
way = OSM::Way.new make_osm_id, OSM_USER, OSM_TIMESTAMP
|
||||
way.uid = OSM_UID
|
||||
|
||||
|
||||
nodes = row.delete 'nodes'
|
||||
raise "*** duplicate way '#{nodes}'" if name_way_hash[nodes]
|
||||
nodes.each_char do |c|
|
||||
@@ -64,14 +64,14 @@ Given /^the ways$/ do |table|
|
||||
raise "*** unknown node '#{c}'" unless node
|
||||
way << node
|
||||
end
|
||||
|
||||
|
||||
defaults = { 'highway' => 'primary' }
|
||||
tags = defaults.merge(row)
|
||||
|
||||
if row['highway'] == '(nil)'
|
||||
tags.delete 'highway'
|
||||
end
|
||||
|
||||
|
||||
if row['name'] == nil
|
||||
tags['name'] = nodes
|
||||
elsif (row['name'] == '""') || (row['name'] == "''")
|
||||
@@ -81,7 +81,7 @@ Given /^the ways$/ do |table|
|
||||
else
|
||||
tags['name'] = row['name']
|
||||
end
|
||||
|
||||
|
||||
way << tags
|
||||
osm_db << way
|
||||
name_way_hash[nodes] = way
|
||||
|
||||
@@ -16,9 +16,9 @@ When /^I request nearest I should get$/ do |table|
|
||||
coord = json['mapped_coordinate']
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
got = {'in' => row['in'], 'out' => coord }
|
||||
|
||||
|
||||
ok = true
|
||||
row.keys.each do |key|
|
||||
if key=='out'
|
||||
@@ -30,12 +30,12 @@ When /^I request nearest I should get$/ do |table|
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
unless ok
|
||||
failed = { :attempt => 'nearest', :query => @query, :response => response }
|
||||
log_fail row,got,[failed]
|
||||
end
|
||||
|
||||
|
||||
actual << got
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,11 +8,11 @@ When /^I route I should get$/ do |table|
|
||||
node = find_node_by_name(row['from'])
|
||||
raise "*** unknown from-node '#{row['from']}" unless node
|
||||
waypoints << node
|
||||
|
||||
|
||||
node = find_node_by_name(row['to'])
|
||||
raise "*** unknown to-node '#{row['to']}" unless node
|
||||
waypoints << node
|
||||
|
||||
|
||||
got = {'from' => row['from'], 'to' => row['to'] }
|
||||
elsif row['waypoints']
|
||||
row['waypoints'].split(',').each do |n|
|
||||
@@ -24,7 +24,7 @@ When /^I route I should get$/ do |table|
|
||||
else
|
||||
raise "*** no waypoints"
|
||||
end
|
||||
|
||||
|
||||
params = {}
|
||||
row.each_pair do |k,v|
|
||||
if k =~ /param:(.*)/
|
||||
@@ -36,7 +36,7 @@ When /^I route I should get$/ do |table|
|
||||
got[k]=v
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
response = request_route(waypoints, params)
|
||||
if response.code == "200" && response.body.empty? == false
|
||||
json = JSON.parse response.body
|
||||
@@ -48,7 +48,7 @@ When /^I route I should get$/ do |table|
|
||||
modes = mode_list json['route_instructions']
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if table.headers.include? 'start'
|
||||
got['start'] = instructions ? json['route_summary']['start_point'] : nil
|
||||
end
|
||||
@@ -83,7 +83,7 @@ When /^I route I should get$/ do |table|
|
||||
got['#'] = row['#'] # copy value so it always match
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
ok = true
|
||||
row.keys.each do |key|
|
||||
if FuzzyMatch.match got[key], row[key]
|
||||
@@ -92,12 +92,12 @@ When /^I route I should get$/ do |table|
|
||||
ok = false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
unless ok
|
||||
failed = { :attempt => 'route', :query => @query, :response => response }
|
||||
log_fail row,got,[failed]
|
||||
end
|
||||
|
||||
|
||||
actual << got
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user