aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/postgresql/uuid_test.rb
diff options
context:
space:
mode:
authorBrian Buchanan <brian@tiogalake.com>2013-05-03 16:05:55 -0700
committerBrian Buchanan <brian@tiogalake.com>2013-05-03 16:05:55 -0700
commitfa87e3166fd404f9d494965fb20712a55af078fb (patch)
tree9205cdedfa7c723c529dfb831b6fcba80587b5bd /activerecord/test/cases/adapters/postgresql/uuid_test.rb
parent9a4268db99d93190c58bddcb150832727a0d5129 (diff)
downloadrails-fa87e3166fd404f9d494965fb20712a55af078fb.tar.gz
rails-fa87e3166fd404f9d494965fb20712a55af078fb.tar.bz2
rails-fa87e3166fd404f9d494965fb20712a55af078fb.zip
Make SchemaDumper emit "id: :uuid" when appropriate. Fixes #10451.
Diffstat (limited to 'activerecord/test/cases/adapters/postgresql/uuid_test.rb')
-rw-r--r--activerecord/test/cases/adapters/postgresql/uuid_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/uuid_test.rb b/activerecord/test/cases/adapters/postgresql/uuid_test.rb
index 04c9065393..0bd9c864ec 100644
--- a/activerecord/test/cases/adapters/postgresql/uuid_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/uuid_test.rb
@@ -50,6 +50,18 @@ class PostgresqlUUIDTest < ActiveRecord::TestCase
u.reload
assert_not_nil u.other_uuid
end
+
+ def test_pk_and_sequence_for_uuid_primary_key
+ pk, seq = @connection.pk_and_sequence_for('pg_uuids')
+ assert_equal 'id', pk
+ assert_equal nil, seq
+ end
+
+ def test_schema_dumper_for_uuid_primary_key
+ schema = StringIO.new
+ ActiveRecord::SchemaDumper.dump(@connection, schema)
+ assert_match /\bcreate_table "pg_uuids", id: :uuid\b/, schema.string
+ end
end
class PostgresqlUUIDTestNilDefault < ActiveRecord::TestCase