- assert_select "diffResult[version='#{Settings.api_version}'][generator='#{Settings.generator}']", 1
- assert_select "diffResult>node", 1
- assert_select "diffResult>way", 1
- assert_select "diffResult>relation", 1
-
- # parse the response
- doc = XML::Parser.string(@response.body).parse
-
- # check the old IDs are all present and what we expect
- assert_equal used_node.id, doc.find("//diffResult/node").first["old_id"].to_i
- assert_equal used_way.id, doc.find("//diffResult/way").first["old_id"].to_i
- assert_equal used_relation.id, doc.find("//diffResult/relation").first["old_id"].to_i
-
- # check the new IDs are all present and unchanged
- assert_equal used_node.id, doc.find("//diffResult/node").first["new_id"].to_i
- assert_equal used_way.id, doc.find("//diffResult/way").first["new_id"].to_i
- assert_equal used_relation.id, doc.find("//diffResult/relation").first["new_id"].to_i
-
- # check the new versions are all present and unchanged
- assert_equal used_node.version, doc.find("//diffResult/node").first["new_version"].to_i
- assert_equal used_way.version, doc.find("//diffResult/way").first["new_version"].to_i
- assert_equal used_relation.version, doc.find("//diffResult/relation").first["new_version"].to_i
+ assert_dom "diffResult[version='#{Settings.api_version}'][generator='#{Settings.generator}']", 1 do
+ # check the old IDs are all present and what we expect
+ # check the new IDs are all present and unchanged
+ # check the new versions are all present and unchanged
+ assert_dom "> node", 1 do
+ assert_dom "> @old_id", used_node.id.to_s
+ assert_dom "> @new_id", used_node.id.to_s
+ assert_dom "> @new_version", used_node.version.to_s
+ end
+ assert_dom "> way", 1 do
+ assert_dom "> @old_id", used_way.id.to_s
+ assert_dom "> @new_id", used_way.id.to_s
+ assert_dom "> @new_version", used_way.version.to_s
+ end
+ assert_dom "> relation", 1 do
+ assert_dom "> @old_id", used_relation.id.to_s
+ assert_dom "> @new_id", used_relation.id.to_s
+ assert_dom "> @new_version", used_relation.version.to_s
+ end
+ end