From 6afd13602c18946e33197397f88603b1c1bb5ceb Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Thu, 30 Mar 2017 15:13:22 +0100 Subject: [PATCH 1/1] Fix tests that referred to node lat and lons --- test/controllers/api_controller_test.rb | 4 ++-- test/controllers/way_controller_test.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/controllers/api_controller_test.rb b/test/controllers/api_controller_test.rb index 5aac44a4f..7d249acf3 100644 --- a/test/controllers/api_controller_test.rb +++ b/test/controllers/api_controller_test.rb @@ -69,7 +69,7 @@ class ApiControllerTest < ActionController::TestCase assert_response :success, "Expected scucess with the map call" assert_select "osm[version='#{API_VERSION}'][generator='#{GENERATOR}']", :count => 1 do assert_select "bounds[minlon='#{minlon}'][minlat='#{minlat}'][maxlon='#{maxlon}'][maxlat='#{maxlat}']", :count => 1 - assert_select "node[id='#{node.id}'][lat='#{node.lat}'][lon='#{node.lon}'][version='#{node.version}'][changeset='#{node.changeset_id}'][visible='#{node.visible}'][timestamp='#{node.timestamp.xmlschema}']", :count => 1 do + assert_select "node[id='#{node.id}'][lat='#{format('%.7f', node.lat)}'][lon='#{format('%.7f', node.lon)}'][version='#{node.version}'][changeset='#{node.changeset_id}'][visible='#{node.visible}'][timestamp='#{node.timestamp.xmlschema}']", :count => 1 do # This should really be more generic assert_select "tag[k='#{tag.k}'][v='#{tag.v}']" end @@ -91,7 +91,7 @@ class ApiControllerTest < ActionController::TestCase assert_response :success, "The map call should have succeeded" assert_select "osm[version='#{API_VERSION}'][generator='#{GENERATOR}']", :count => 1 do assert_select "bounds[minlon='#{node.lon}'][minlat='#{node.lat}'][maxlon='#{node.lon}'][maxlat='#{node.lat}']", :count => 1 - assert_select "node[id='#{node.id}'][lat='#{node.lat}'][lon='#{node.lon}'][version='#{node.version}'][changeset='#{node.changeset_id}'][visible='#{node.visible}'][timestamp='#{node.timestamp.xmlschema}']", :count => 1 do + assert_select "node[id='#{node.id}'][lat='#{format('%.7f', node.lat)}'][lon='#{format('%.7f', node.lon)}'][version='#{node.version}'][changeset='#{node.changeset_id}'][visible='#{node.visible}'][timestamp='#{node.timestamp.xmlschema}']", :count => 1 do # This should really be more generic assert_select "tag[k='#{tag.k}'][v='#{tag.v}']" end diff --git a/test/controllers/way_controller_test.rb b/test/controllers/way_controller_test.rb index 650977078..ae52c036f 100644 --- a/test/controllers/way_controller_test.rb +++ b/test/controllers/way_controller_test.rb @@ -74,7 +74,7 @@ class WayControllerTest < ActionController::TestCase way.nodes.each do |n| count = (way.nodes - (way.nodes - [n])).length assert_select "osm way nd[ref='#{n.id}']", count - assert_select "osm node[id='#{n.id}'][version='#{n.version}'][lat='#{n.lat}'][lon='#{n.lon}']", 1 + assert_select "osm node[id='#{n.id}'][version='#{n.version}'][lat='#{format('%.7f', n.lat)}'][lon='#{format('%.7f', n.lon)}']", 1 end end end -- 2.43.2