]> git.openstreetmap.org Git - rails.git/blobdiff - test/models/node_tag_test.rb
Bump eslint from 8.37.0 to 8.38.0
[rails.git] / test / models / node_tag_test.rb
index ffc8fb422d4655ac806a9ae861478c06bf35762a..d927b5fea202edc7d9f945c40fa13bc2bdacbb0f 100644 (file)
@@ -31,18 +31,16 @@ class NodeTagTest < ActiveSupport::TestCase
     assert_predicate tag.errors[:v], :any?
   end
 
-  def test_empty_node_tag_invalid
-    tag = NodeTag.new
-    assert_not tag.valid?, "Empty tag should be invalid"
+  def test_orphaned_node_tag_invalid
+    tag = create(:node_tag)
+    tag.node = nil
+    assert_not tag.valid?, "Orphaned tag should be invalid"
     assert_predicate tag.errors[:node], :any?
   end
 
   def test_uniqueness
     existing = create(:node_tag)
-    tag = NodeTag.new
-    tag.node_id = existing.node_id
-    tag.k = existing.k
-    tag.v = existing.v
+    tag = build(:node_tag, :node => existing.node, :k => existing.k, :v => existing.v)
     assert_predicate tag, :new_record?
     assert_not tag.valid?
     assert_raise(ActiveRecord::RecordInvalid) { tag.save! }