X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/d43315f738a415823c42e4b7d3df83c1d3aa9263..6a77bbe544b9866844473230b0c2406062ab9b5b:/test/test_helper.rb diff --git a/test/test_helper.rb b/test/test_helper.rb index d44fcd253..e4db27d31 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,6 +1,15 @@ require "coveralls" Coveralls.wear!("rails") +# Override the simplecov output message, since it is mostly unwanted noise +module SimpleCov + module Formatter + class HTMLFormatter + def output_message(_result); end + end + end +end + # Output both the local simplecov html and the coveralls report SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new( [SimpleCov::Formatter::HTMLFormatter, @@ -161,5 +170,31 @@ module ActiveSupport fill_in "password", :with => "test" click_on "Login", :match => :first end + + def xml_for_node(node) + doc = OSM::API.new.get_xml_doc + doc.root << xml_node_for_node(node) + doc + end + + def xml_node_for_node(node) + el = XML::Node.new "node" + el["id"] = node.id.to_s + + OMHelper.add_metadata_to_xml_node(el, node, {}, {}) + + if node.visible? + el["lat"] = node.lat.to_s + el["lon"] = node.lon.to_s + end + + OMHelper.add_tags_to_xml_node(el, node.node_tags) + + el + end + + class OMHelper + extend ObjectMetadata + end end end