X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/420a7289a0b08eee091f6650c2e83166df3fbe69..399ade116adb8250bbf92efa8dfeb3ca1090c7e4:/test/models/relation_test.rb diff --git a/test/models/relation_test.rb b/test/models/relation_test.rb index e6d0c0abd..6b76d82a4 100644 --- a/test/models/relation_test.rb +++ b/test/models/relation_test.rb @@ -207,4 +207,29 @@ class RelationTest < ActiveSupport::TestCase assert_equal 39, changeset.min_lat assert_equal 39, changeset.max_lat end + + def test_changeset_bbox_delete_relation + orig_relation = create(:relation) + node1 = create(:node, :longitude => 116, :latitude => 39) + node2 = create(:node, :longitude => 39, :latitude => 116) + create(:relation_member, :relation => orig_relation, :member_type => "Node", :member_id => node1.id) + create(:relation_member, :relation => orig_relation, :member_type => "Node", :member_id => node2.id) + user = create(:user) + changeset = create(:changeset, :user => user) + assert_nil changeset.min_lon + assert_nil changeset.max_lon + assert_nil changeset.max_lat + assert_nil changeset.min_lat + + new_relation = Relation.new + new_relation.id = orig_relation.id + new_relation.version = orig_relation.version + new_relation.changeset_id = changeset.id + orig_relation.delete_with_history!(new_relation, user) + changeset.reload + assert_equal 39, changeset.min_lon + assert_equal 116, changeset.max_lon + assert_equal 39, changeset.min_lat + assert_equal 116, changeset.max_lat + end end