diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-06-14 18:55:10 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-06-14 18:55:10 -0300 |
commit | 57a952a223e10b1f4062f45a9490dc7076ea40ba (patch) | |
tree | a3d1b23752297c22e44862962b9340b8f1e40cf8 /activerecord/test/cases/adapters/postgresql/datatype_test.rb | |
parent | 86af7d357899057f1565b2ebbeb4f3c3235846a1 (diff) | |
parent | 12e9a75f227ea7bcc23e2717e9ff5a72ec64e1f1 (diff) | |
download | rails-57a952a223e10b1f4062f45a9490dc7076ea40ba.tar.gz rails-57a952a223e10b1f4062f45a9490dc7076ea40ba.tar.bz2 rails-57a952a223e10b1f4062f45a9490dc7076ea40ba.zip |
Merge pull request #6713 from etehtsea/activerecord-uuid
Add uuid datatype support to PostgreSQL adapter
Diffstat (limited to 'activerecord/test/cases/adapters/postgresql/datatype_test.rb')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/datatype_test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/datatype_test.rb b/activerecord/test/cases/adapters/postgresql/datatype_test.rb index 34660577da..a4d9286d52 100644 --- a/activerecord/test/cases/adapters/postgresql/datatype_test.rb +++ b/activerecord/test/cases/adapters/postgresql/datatype_test.rb @@ -27,6 +27,9 @@ end class PostgresqlTimestampWithZone < ActiveRecord::Base end +class PostgresqlUUID < ActiveRecord::Base +end + class PostgresqlDataTypeTest < ActiveRecord::TestCase self.use_transactional_fixtures = false @@ -61,6 +64,9 @@ class PostgresqlDataTypeTest < ActiveRecord::TestCase @first_oid = PostgresqlOid.find(1) @connection.execute("INSERT INTO postgresql_timestamp_with_zones (time) VALUES ('2010-01-01 10:00:00-1')") + + @connection.execute("INSERT INTO postgresql_uuids (guid, compact_guid) VALUES('d96c3da0-96c1-012f-1316-64ce8f32c6d8', 'f06c715096c1012f131764ce8f32c6d8')") + @first_uuid = PostgresqlUUID.find(1) end def test_data_type_of_array_types @@ -100,6 +106,10 @@ class PostgresqlDataTypeTest < ActiveRecord::TestCase assert_equal :integer, @first_oid.column_for_attribute(:obj_id).type end + def test_data_type_of_uuid_types + assert_equal :uuid, @first_uuid.column_for_attribute(:guid).type + end + def test_array_values assert_equal '{35000,21000,18000,17000}', @first_array.commission_by_quarter assert_equal '{foo,bar,baz}', @first_array.nicknames @@ -143,6 +153,11 @@ class PostgresqlDataTypeTest < ActiveRecord::TestCase assert_equal '01:23:45:67:89:0a', @first_network_address.mac_address end + def test_uuid_values + assert_equal 'd96c3da0-96c1-012f-1316-64ce8f32c6d8', @first_uuid.guid + assert_equal 'f06c7150-96c1-012f-1317-64ce8f32c6d8', @first_uuid.compact_guid + end + def test_bit_string_values assert_equal '00010101', @first_bit_string.bit_string assert_equal '00010101', @first_bit_string.bit_string_varying |