]> git.openstreetmap.org Git - rails.git/blobdiff - test/unit/changeset_tag_test.rb
Add HOT layer to the main page
[rails.git] / test / unit / changeset_tag_test.rb
index 46194b505ff7dc3a92a5005fc55d2b79aba44063..cff75a5be9e137579fd0cefda2a0e87ffd9248df 100644 (file)
@@ -11,7 +11,7 @@ class ChangesetTagTest < ActiveSupport::TestCase
     key = "k"
     (0..255).each do |i|
       tag = ChangesetTag.new
-      tag.id = 1
+      tag.changeset_id = 1
       tag.k = key*i
       tag.v = "v"
       assert tag.valid?
@@ -22,7 +22,7 @@ class ChangesetTagTest < ActiveSupport::TestCase
     val = "v"
     (0..255).each do |i|
       tag = ChangesetTag.new
-      tag.id = 1
+      tag.changeset_id = 1
       tag.k = "k"
       tag.v = val*i
       assert tag.valid?
@@ -32,34 +32,34 @@ class ChangesetTagTest < ActiveSupport::TestCase
   def test_length_key_invalid
     ["k"*256].each do |k|
       tag = ChangesetTag.new
-      tag.id = 1
+      tag.changeset_id = 1
       tag.k = k
       tag.v = "v"
       assert !tag.valid?, "Key #{k} should be too long"
-      assert tag.errors.invalid?(:k)
+      assert tag.errors[:k].any?
     end
   end
   
   def test_length_value_invalid
     ["v"*256].each do |v|
       tag = ChangesetTag.new
-      tag.id = 1
+      tag.changeset_id = 1
       tag.k = "k"
       tag.v = v
       assert !tag.valid?, "Value #{v} should be too long"
-      assert tag.errors.invalid?(:v)
+      assert tag.errors[:v].any?
     end
   end
   
   def test_empty_tag_invalid
     tag = ChangesetTag.new
     assert !tag.valid?, "Empty tag should be invalid"
-    assert tag.errors.invalid?(:id)
+    assert tag.errors[:changeset].any?
   end
   
   def test_uniqueness
     tag = ChangesetTag.new
-    tag.id = changeset_tags(:changeset_1_tag_1).id
+    tag.changeset_id = changeset_tags(:changeset_1_tag_1).changeset_id
     tag.k = changeset_tags(:changeset_1_tag_1).k
     tag.v = changeset_tags(:changeset_1_tag_1).v
     assert tag.new_record?