fix the user unit test so that it doesn't use a depricated method in rails 2.2.2
[rails.git] / test / unit / old_node_tag_test.rb
index 4a9bcbfcb95fbb4ba52a92bd49b33c8ef012f7c7..f2203005cc677e119bf0bf7a6cc2a8668e00453a 100644 (file)
@@ -1,12 +1,10 @@
 require File.dirname(__FILE__) + '/../test_helper'
 
 class OldNodeTest < Test::Unit::TestCase
-  set_fixture_class :nodes => OldNode
-  set_fixture_class :node_tags => OldNodeTag
-  fixtures  :users, :nodes, :node_tags
-  
+  api_fixtures
+
   def test_old_node_tag_count
-    assert_equal 8, OldNodeTag.count, "Unexpected number of fixtures loaded."
+    assert_equal 9, OldNodeTag.count, "Unexpected number of fixtures loaded."
   end
   
   def test_length_key_valid
@@ -63,4 +61,16 @@ class OldNodeTest < Test::Unit::TestCase
     assert tag.errors.invalid?(:id)
     assert tag.errors.invalid?(:version)
   end
+  
+  def test_uniqueness
+    tag = OldNodeTag.new
+    tag.id = node_tags(:t1).id
+    tag.version = node_tags(:t1).version
+    tag.k = node_tags(:t1).k
+    tag.v = node_tags(:t1).v
+    assert tag.new_record?
+    assert !tag.valid?
+    assert_raise(ActiveRecord::RecordInvalid) {tag.save!}
+    assert tag.new_record?
+  end
 end