Fix bogus test class names
[rails.git] / test / unit / old_way_tag_test.rb
index 8210ef0c4123d13817ea77c60d04ecf93f61409f..107111b1085f7e7b6525e1b09d4fce8a7e5ba40b 100644 (file)
@@ -1,22 +1,21 @@
 require File.dirname(__FILE__) + '/../test_helper'
 
-class WayTagTest < Test::Unit::TestCase
-  fixtures :way_tags
-  set_fixture_class :way_tags => OldWayTag
+class OldWayTagTest < ActiveSupport::TestCase
+  api_fixtures
   
   def test_tag_count
-    assert_equal 3, OldWayTag.count
+    assert_equal 7, OldWayTag.count
   end
   
   def test_length_key_valid
     key = "k"
     (0..255).each do |i|
       tag = OldWayTag.new
-      tag.id = way_tags(:t1).id
+      tag.way_id = way_tags(:t1).way_id
       tag.version = 1
       tag.k = key*i
       tag.v = "v"
-      assert_valid tag
+      assert tag.valid?
     end
   end
   
@@ -24,47 +23,47 @@ class WayTagTest < Test::Unit::TestCase
     val = "v"
     (0..255).each do |i|
       tag = OldWayTag.new
-      tag.id = way_tags(:t1).id
+      tag.way_id = way_tags(:t1).way_id
       tag.version = 1
       tag.k = "k"
       tag.v = val*i
-      assert_valid tag
+      assert tag.valid?
     end
   end
   
   def test_length_key_invalid
     ["k"*256].each do |i|
       tag = OldWayTag.new
-      tag.id = way_tags(:t1).id
+      tag.way_id = way_tags(:t1).way_id
       tag.version = 1
       tag.k = i
       tag.v = "v"
       assert !tag.valid?, "Key should be too long"
-      assert tag.errors.invalid?(:k)
+      assert tag.errors[:k].any?
     end
   end
   
   def test_length_value_invalid
     ["k"*256].each do |i|
       tag = OldWayTag.new
-      tag.id = way_tags(:t1).id
+      tag.way_id = way_tags(:t1).way_id
       tag.version = 1
       tag.k = "k"
       tag.v = i
       assert !tag.valid?, "Value should be too long"
-      assert tag.errors.invalid?(:v)
+      assert tag.errors[:v].any?
     end
   end
   
-  def test_empty_node_tag_invalid
-    tag = OldNodeTag.new
+  def test_empty_tag_invalid
+    tag = OldWayTag.new
     assert !tag.valid?, "Empty tag should be invalid"
-    assert tag.errors.invalid?(:id)
+    assert tag.errors[:old_way].any?
   end
   
   def test_uniqueness
     tag = OldWayTag.new
-    tag.id = way_tags(:t1).id
+    tag.way_id = way_tags(:t1).way_id
     tag.version = way_tags(:t1).version
     tag.k = way_tags(:t1).k
     tag.v = way_tags(:t1).v