]> git.openstreetmap.org Git - rails.git/blobdiff - vendor/gems/composite_primary_keys-1.1.0/test/test_find.rb
Updating for rails 2.2.2
[rails.git] / vendor / gems / composite_primary_keys-1.1.0 / test / test_find.rb
diff --git a/vendor/gems/composite_primary_keys-1.1.0/test/test_find.rb b/vendor/gems/composite_primary_keys-1.1.0/test/test_find.rb
deleted file mode 100644 (file)
index a07d30a..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-require 'abstract_unit'\r
-require 'fixtures/reference_type'\r
-require 'fixtures/reference_code'\r
-\r
-# Testing the find action on composite ActiveRecords with two primary keys\r
-class TestFind < Test::Unit::TestCase\r
-  fixtures :reference_types, :reference_codes\r
-  \r
-  CLASSES = {\r
-    :single => {\r
-      :class => ReferenceType,\r
-      :primary_keys => [:reference_type_id],\r
-    },\r
-    :dual   => { \r
-      :class => ReferenceCode,\r
-      :primary_keys => [:reference_type_id, :reference_code],\r
-    },\r
-    :dual_strs   => { \r
-      :class => ReferenceCode,\r
-      :primary_keys => ['reference_type_id', 'reference_code'],\r
-    },\r
-  }\r
-  \r
-  def setup\r
-    self.class.classes = CLASSES\r
-  end\r
-  \r
-  def test_find_first\r
-    testing_with do\r
-      obj = @klass.find(:first)\r
-      assert obj\r
-      assert_equal @klass, obj.class\r
-    end\r
-  end\r
-  \r
-  def test_find\r
-    testing_with do\r
-      found = @klass.find(*first_id) # e.g. find(1,1) or find 1,1\r
-      assert found\r
-      assert_equal @klass, found.class\r
-      assert_equal found, @klass.find(found.id)\r
-      assert_equal found, @klass.find(found.to_param)\r
-    end\r
-  end\r
-  \r
-  def test_find_composite_ids\r
-    testing_with do\r
-      found = @klass.find(first_id) # e.g. find([1,1].to_composite_ids)\r
-      assert found\r
-      assert_equal @klass, found.class\r
-      assert_equal found, @klass.find(found.id)\r
-      assert_equal found, @klass.find(found.to_param)\r
-    end\r
-  end\r
-  \r
-  def test_to_param\r
-    testing_with do\r
-      assert_equal first_id_str, @first.to_param.to_s\r
-    end\r
-  end\r
-  \r
-  def things_to_look_at\r
-    testing_with do\r
-      assert_equal found, @klass.find(found.id.to_s) # fails for 2+ keys\r
-    end\r
-  end\r
-  \r
-  def test_not_found\r
-    assert_raise(::ActiveRecord::RecordNotFound) do\r
-      ReferenceCode.send :find, '999,999'\r
-    end\r
-  end\r
-end
\ No newline at end of file