]> git.openstreetmap.org Git - rails.git/blobdiff - vendor/gems/composite_primary_keys-1.1.0/test/test_miscellaneous.rb
Freezing composite primary key so that we can apply TomH's patch to it, and that...
[rails.git] / vendor / gems / composite_primary_keys-1.1.0 / test / test_miscellaneous.rb
diff --git a/vendor/gems/composite_primary_keys-1.1.0/test/test_miscellaneous.rb b/vendor/gems/composite_primary_keys-1.1.0/test/test_miscellaneous.rb
new file mode 100644 (file)
index 0000000..25f6096
--- /dev/null
@@ -0,0 +1,39 @@
+require 'abstract_unit'\r
+require 'fixtures/reference_type'\r
+require 'fixtures/reference_code'\r
+\r
+class TestMiscellaneous < Test::Unit::TestCase\r
+  fixtures :reference_types, :reference_codes, :products\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
+  }\r
+  \r
+  def setup\r
+    self.class.classes = CLASSES\r
+  end\r
+\r
+  def test_composite_class\r
+    testing_with do\r
+      assert_equal composite?, @klass.composite?\r
+    end\r
+  end\r
+\r
+  def test_composite_instance\r
+    testing_with do\r
+      assert_equal composite?, @first.composite?\r
+    end\r
+  end\r
+  \r
+  def test_count\r
+    assert_equal 2, Product.count\r
+  end\r
+  \r
+end
\ No newline at end of file