]> git.openstreetmap.org Git - rails.git/blob - vendor/gems/composite_primary_keys-1.1.0/test/test_attribute_methods.rb
Merge 14394:14533 from trunk.
[rails.git] / vendor / gems / composite_primary_keys-1.1.0 / test / test_attribute_methods.rb
1 require 'abstract_unit'
2 require 'fixtures/kitchen_sink'
3 require 'fixtures/reference_type'
4
5 class TestAttributeMethods < Test::Unit::TestCase
6   fixtures :kitchen_sinks, :reference_types
7   
8   def test_read_attribute_with_single_key
9     rt = ReferenceType.find(1)
10     assert_equal(1, rt.reference_type_id)
11     assert_equal('NAME_PREFIX', rt.type_label)
12     assert_equal('Name Prefix', rt.abbreviation)
13   end
14
15   def test_read_attribute_with_composite_keys
16     sink = KitchenSink.find(1,2)
17     assert_equal(1, sink.id_1)
18     assert_equal(2, sink.id_2)
19     assert_equal(Date.today, sink.a_date.to_date)
20     assert_equal('string', sink.a_string)
21   end
22 end