aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/primary_keys_test.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2016-12-06 05:38:14 +0900
committerRyuta Kamizono <kamipo@gmail.com>2016-12-06 05:38:14 +0900
commit974e860172b5e0f05a649211c11c328bc9e94a0c (patch)
tree5cbc7062089354f14ac3329a7a778fd3e1176944 /activerecord/test/cases/primary_keys_test.rb
parent575212a1ba2e4d170985531402c6e3d27af5a0ea (diff)
downloadrails-974e860172b5e0f05a649211c11c328bc9e94a0c.tar.gz
rails-974e860172b5e0f05a649211c11c328bc9e94a0c.tar.bz2
rails-974e860172b5e0f05a649211c11c328bc9e94a0c.zip
Make `:auto_increment` option works on `:bigint`
Follow up to #27272.
Diffstat (limited to 'activerecord/test/cases/primary_keys_test.rb')
-rw-r--r--activerecord/test/cases/primary_keys_test.rb26
1 files changed, 18 insertions, 8 deletions
diff --git a/activerecord/test/cases/primary_keys_test.rb b/activerecord/test/cases/primary_keys_test.rb
index 7599434f4f..d2207e2489 100644
--- a/activerecord/test/cases/primary_keys_test.rb
+++ b/activerecord/test/cases/primary_keys_test.rb
@@ -224,7 +224,6 @@ class PrimaryKeyWithAutoIncrementTest < ActiveRecord::TestCase
def setup
@connection = ActiveRecord::Base.connection
- @connection.create_table(:auto_increments, id: :integer, auto_increment: true, force: true)
end
def teardown
@@ -232,15 +231,26 @@ class PrimaryKeyWithAutoIncrementTest < ActiveRecord::TestCase
end
def test_primary_key_with_auto_increment
- record1 = AutoIncrement.create!
- assert_not_nil record1.id
-
- record1.destroy
+ @connection.create_table(:auto_increments, id: :integer, auto_increment: true, force: true)
+ assert_auto_incremented
+ end
- record2 = AutoIncrement.create!
- assert_not_nil record2.id
- assert_operator record2.id, :>, record1.id
+ def test_primary_key_with_auto_increment_and_bigint
+ @connection.create_table(:auto_increments, id: :bigint, auto_increment: true, force: true)
+ assert_auto_incremented
end
+
+ private
+ def assert_auto_incremented
+ record1 = AutoIncrement.create!
+ assert_not_nil record1.id
+
+ record1.destroy
+
+ record2 = AutoIncrement.create!
+ assert_not_nil record2.id
+ assert_operator record2.id, :>, record1.id
+ end
end
class PrimaryKeyAnyTypeTest < ActiveRecord::TestCase