Skip to content

Commit b8bd24d

Browse files
committed
Skip another test when ARCONN=sqlite3_mem
1 parent 95c12c9 commit b8bd24d

File tree

1 file changed

+28
-22
lines changed

1 file changed

+28
-22
lines changed

activerecord/test/cases/migration/foreign_key_test.rb

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -555,31 +555,37 @@ def test_schema_dumping_with_defferable_initially_immediate
555555
end
556556

557557
def test_does_not_create_foreign_keys_when_bypassed_by_config
558-
connection = ActiveRecord::Base.establish_connection(
559-
{
560-
adapter: "sqlite3",
561-
database: "test/db/test.sqlite3",
562-
foreign_keys: false,
563-
}
564-
).connection
565-
566-
connection.create_table "rockets", force: true do |t|
567-
t.string :name
568-
end
569-
connection.create_table "astronauts", force: true do |t|
570-
t.string :name
571-
t.references :rocket
572-
end
558+
if current_adapter?(:SQLite3Adapter) && !ActiveRecord::Base.connection.supports_concurrent_connections?
559+
skip("Can't reopen in-memory database")
560+
else
561+
begin
562+
connection = ActiveRecord::Base.establish_connection(
563+
{
564+
adapter: "sqlite3",
565+
database: "test/db/test.sqlite3",
566+
foreign_keys: false,
567+
}
568+
).connection
569+
570+
connection.create_table "rockets", force: true do |t|
571+
t.string :name
572+
end
573+
connection.create_table "astronauts", force: true do |t|
574+
t.string :name
575+
t.references :rocket
576+
end
573577

574-
connection.add_foreign_key :astronauts, :rockets
578+
connection.add_foreign_key :astronauts, :rockets
575579

576-
foreign_keys = connection.foreign_keys("astronauts")
577-
assert_equal 0, foreign_keys.size
578-
ensure
579-
connection.drop_table "astronauts", if_exists: true rescue nil
580-
connection.drop_table "rockets", if_exists: true rescue nil
580+
foreign_keys = connection.foreign_keys("astronauts")
581+
assert_equal 0, foreign_keys.size
582+
ensure
583+
connection.drop_table "astronauts", if_exists: true rescue nil
584+
connection.drop_table "rockets", if_exists: true rescue nil
581585

582-
ActiveRecord::Base.establish_connection(:arunit)
586+
ActiveRecord::Base.establish_connection(:arunit)
587+
end
588+
end
583589
end
584590

585591
def test_schema_dumping

0 commit comments

Comments
 (0)