]> git.openstreetmap.org Git - rails.git/blobdiff - test/models/old_relation_tag_test.rb
Rewrite bbox only in place history atom links
[rails.git] / test / models / old_relation_tag_test.rb
index a373e386df53bf839bed90ba965b6cd26221e133..d920f91da197370f8225ece0c43b8778d222ff84 100644 (file)
@@ -31,19 +31,16 @@ class OldRelationTagTest < ActiveSupport::TestCase
     assert_predicate tag.errors[:v], :any?
   end
 
-  def test_empty_tag_invalid
-    tag = OldRelationTag.new
-    assert_not tag.valid?, "Empty tag should be invalid"
+  def test_orphaned_tag_invalid
+    tag = create(:old_relation_tag)
+    tag.old_relation = nil
+    assert_not tag.valid?, "Orphaned tag should be invalid"
     assert_predicate tag.errors[:old_relation], :any?
   end
 
   def test_uniqueness
     existing = create(:old_relation_tag)
-    tag = OldRelationTag.new
-    tag.relation_id = existing.relation_id
-    tag.version = existing.version
-    tag.k = existing.k
-    tag.v = existing.v
+    tag = build(:old_relation_tag, :old_relation => existing.old_relation, :version => existing.version, :k => existing.k, :v => existing.v)
     assert_predicate tag, :new_record?
     assert_not tag.valid?
     assert_raise(ActiveRecord::RecordInvalid) { tag.save! }