]> git.openstreetmap.org Git - rails.git/blob - vendor/gems/composite_primary_keys-2.2.2/test/test_miscellaneous.rb
Handle Timeout::Error exceptions which are caught by ActiveRecord.
[rails.git] / vendor / gems / composite_primary_keys-2.2.2 / test / test_miscellaneous.rb
1 require 'abstract_unit'\r
2 require 'fixtures/reference_type'\r
3 require 'fixtures/reference_code'\r
4 \r
5 class TestMiscellaneous < Test::Unit::TestCase\r
6   fixtures :reference_types, :reference_codes, :products\r
7   \r
8   CLASSES = {\r
9     :single => {\r
10       :class => ReferenceType,\r
11       :primary_keys => :reference_type_id,\r
12     },\r
13     :dual   => { \r
14       :class => ReferenceCode,\r
15       :primary_keys => [:reference_type_id, :reference_code],\r
16     },\r
17   }\r
18   \r
19   def setup\r
20     self.class.classes = CLASSES\r
21   end\r
22 \r
23   def test_composite_class\r
24     testing_with do\r
25       assert_equal composite?, @klass.composite?\r
26     end\r
27   end\r
28 \r
29   def test_composite_instance\r
30     testing_with do\r
31       assert_equal composite?, @first.composite?\r
32     end\r
33   end\r
34   \r
35   def test_count\r
36     assert_equal 2, Product.count\r
37   end\r
38   \r
39 end