X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/5ed8ee39e9a85862c36e0a54a73c1e3a880730f5..42b329ed82c7899b970e1f0fd8d6d29fd625f7d5:/test/unit/old_relation_test.rb diff --git a/test/unit/old_relation_test.rb b/test/unit/old_relation_test.rb index c99491079..31ff83197 100644 --- a/test/unit/old_relation_test.rb +++ b/test/unit/old_relation_test.rb @@ -35,6 +35,70 @@ class OldRelationTest < ActiveSupport::TestCase assert_equal "modified in relation version 4", tags[1].v end + def test_relation_members + relation = relations(:relation_with_versions_v1) + members = OldRelation.find(relation.id).relation_members + assert_equal 1, members.count + assert_equal "some node", members[0].member_role + assert_equal "Node", members[0].member_type + assert_equal 15, members[0].member_id + + relation = relations(:relation_with_versions_v2) + members = OldRelation.find(relation.id).relation_members + assert_equal 1, members.count + assert_equal "some changed node", members[0].member_role + assert_equal "Node", members[0].member_type + assert_equal 15, members[0].member_id + + relation = relations(:relation_with_versions_v3) + members = OldRelation.find(relation.id).relation_members + assert_equal 2, members.count + assert_equal "some changed node", members[0].member_role + assert_equal "Node", members[0].member_type + assert_equal 15, members[0].member_id + assert_equal "some relation", members[1].member_role + assert_equal "Relation", members[1].member_type + assert_equal 7, members[1].member_id + + relation = relations(:relation_with_versions_v4) + members = OldRelation.find(relation.id).relation_members + assert_equal 3, members.count + assert_equal "some node", members[0].member_role + assert_equal "Node", members[0].member_type + assert_equal 15, members[0].member_id + assert_equal "some way", members[1].member_role + assert_equal "Way", members[1].member_type + assert_equal 4, members[1].member_id + assert_equal "some relation", members[2].member_role + assert_equal "Relation", members[2].member_type + assert_equal 7, members[2].member_id + end + + def test_relations + relation = relations(:relation_with_versions_v1) + members = OldRelation.find(relation.id).members + assert_equal 1, members.count + assert_equal ["Node", 15, "some node"], members[0] + + relation = relations(:relation_with_versions_v2) + members = OldRelation.find(relation.id).members + assert_equal 1, members.count + assert_equal ["Node", 15, "some changed node"], members[0] + + relation = relations(:relation_with_versions_v3) + members = OldRelation.find(relation.id).members + assert_equal 2, members.count + assert_equal ["Node", 15, "some changed node"], members[0] + assert_equal ["Relation", 7, "some relation"], members[1] + + relation = relations(:relation_with_versions_v4) + members = OldRelation.find(relation.id).members + assert_equal 3, members.count + assert_equal ["Node", 15, "some node"], members[0] + assert_equal ["Way", 4, "some way"], members[1] + assert_equal ["Relation", 7, "some relation"], members[2] + end + def test_tags relation = relations(:relation_with_versions_v1) tags = OldRelation.find(relation.id).tags