diff options
author | Yves Senn <yves.senn@gmail.com> | 2015-04-27 12:10:43 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2015-04-27 12:12:20 +0200 |
commit | f00554a8226b9529c38be1f3e61b6b1888682fb4 (patch) | |
tree | 38951a55842b5b1869c33504baa4c170db40f0be /activerecord/test/cases | |
parent | 557c46a41ec73c485a783b56fbbe893a00f49fe8 (diff) | |
download | rails-f00554a8226b9529c38be1f3e61b6b1888682fb4.tar.gz rails-f00554a8226b9529c38be1f3e61b6b1888682fb4.tar.bz2 rails-f00554a8226b9529c38be1f3e61b6b1888682fb4.zip |
test, for `create_table` and `foreign_key: true` no-op. Closes #19794.
Add a test-case to make sure that `create_table` with
a `foreign_key: true` and an adapter without foreign key support
does not blow up.
Motivated by #19794.
Originating from: https://github.com/rails/rails/commit/99a6f9e60ea55924b44f894a16f8de0162cf2702#commitcomment-10855210
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/migration/references_foreign_key_test.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/activerecord/test/cases/migration/references_foreign_key_test.rb b/activerecord/test/cases/migration/references_foreign_key_test.rb index 87348d0f90..1594f99852 100644 --- a/activerecord/test/cases/migration/references_foreign_key_test.rb +++ b/activerecord/test/cases/migration/references_foreign_key_test.rb @@ -130,4 +130,24 @@ module ActiveRecord end end end +else +class ReferencesWithoutForeignKeySupportTest < ActiveRecord::TestCase + setup do + @connection = ActiveRecord::Base.connection + @connection.create_table(:testing_parents, force: true) + end + + teardown do + @connection.drop_table("testings", if_exists: true) + @connection.drop_table("testing_parents", if_exists: true) + end + + test "ignores foreign keys defined with the table" do + @connection.create_table :testings do |t| + t.references :testing_parent, foreign_key: true + end + + assert_includes @connection.tables, "testings" + end +end end |