Do not change the global state of the test suite

上级 9d21ef93
......@@ -938,26 +938,9 @@ def test_reflect_the_most_recent_change
unless current_adapter?(:MysqlAdapter, :Mysql2Adapter)
class BelongsToWithForeignKeyTest < ActiveRecord::TestCase
setup do
@connection = ActiveRecord::Base.connection
@connection.create_table :author_addresses, force: true
@connection.create_table :authors, force: true do |t|
t.string :name
t.references :author_address
end
@connection.add_foreign_key :authors, :author_address
end
teardown do
@connection.drop_table :authors, if_exists: true
@connection.drop_table :author_addresses, if_exists: true
end
def test_destroy_linked_models
address = AuthorAddress.create!
author = Author.create! id: 1, name: "Author", author_address_id: address.id
author = Author.create! name: "Author", author_address_id: address.id
author.destroy!
end
......
......@@ -83,6 +83,7 @@ def except(adapter_names_to_exclude)
create_table :author_addresses, force: true do |t|
end
add_foreign_key :authors, :author_address
create_table :author_favorites, force: true do |t|
t.column :author_id, :integer
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册