X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/e660e609661edadc1ed5ad49d6e83e936b2f91cd..1ea64ea977b08e5393d469707e268aee260acd2f:/test/unit/node_test.rb diff --git a/test/unit/node_test.rb b/test/unit/node_test.rb index 78f060678..2b28b3ee6 100644 --- a/test/unit/node_test.rb +++ b/test/unit/node_test.rb @@ -4,7 +4,7 @@ class NodeTest < ActiveSupport::TestCase api_fixtures def test_node_count - assert_equal 16, Node.count + assert_equal 17, Node.count end def test_node_too_far_north @@ -77,13 +77,13 @@ class NodeTest < ActiveSupport::TestCase # Check that you can create a node and store it def test_create - node_template = Node.new({ + node_template = Node.new( :latitude => 12.3456, :longitude => 65.4321, :changeset_id => changesets(:normal_user_first_change).id, :visible => 1, :version => 1 - }, :without_protection => true) + ) assert node_template.create_with_history(users(:normal_user)) node = Node.find(node_template.id) @@ -313,4 +313,22 @@ class NodeTest < ActiveSupport::TestCase } assert_equal "Element node/23 has duplicate tags with key dup", message_update.message end + + def test_node_tags + node = current_nodes(:node_with_versions) + tags = Node.find(node.id).node_tags.order(:k) + assert_equal 2, tags.count + assert_equal "testing", tags[0].k + assert_equal "added in node version 3", tags[0].v + assert_equal "testing two", tags[1].k + assert_equal "modified in node version 4", tags[1].v + end + + def test_tags + node = current_nodes(:node_with_versions) + tags = Node.find(node.id).tags + assert_equal 2, tags.size + assert_equal "added in node version 3", tags["testing"] + assert_equal "modified in node version 4", tags["testing two"] + end end