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
# setup auth
basic_authorization(users(:normal_user).email, "test")
+ existing = create(:way_tag, :way => current_ways(:visible_way))
+
# add an identical tag to the way
tag_xml = XML::Node.new("tag")
- tag_xml["k"] = current_way_tags(:t1).k
- tag_xml["v"] = current_way_tags(:t1).v
+ tag_xml["k"] = existing.k
+ tag_xml["v"] = existing.v
# add the tag into the existing xml
way_xml = current_ways(:visible_way).to_xml
# add an identical tag to the way
tag_xml = XML::Node.new("tag")
- tag_xml["k"] = current_way_tags(:t1).k
- tag_xml["v"] = current_way_tags(:t1).v
+ tag_xml["k"] = existing.k
+ tag_xml["v"] = existing.v
# add the tag into the existing xml
way_xml = current_ways(:visible_way).to_xml
put :update, :id => current_ways(:visible_way).id
assert_response :bad_request,
"adding a duplicate tag to a way should fail with 'bad request'"
- assert_equal "Element way/#{current_ways(:visible_way).id} has duplicate tags with key #{current_way_tags(:t1).k}", @response.body
+ assert_equal "Element way/#{current_ways(:visible_way).id} has duplicate tags with key #{existing.k}", @response.body
end
##
# check that the set of IDs match expectations
expected_way_ids = [current_ways(:visible_way).id,
- current_ways(:used_way).id
- ]
+ current_ways(:used_way).id]
found_way_ids = ways_xml.find("//osm/way").collect { |w| w["id"].to_i }
assert_equal expected_way_ids.sort, found_way_ids.sort,
"expected ways for node #{current_nodes(:used_node_1).id} did not match found"