Skip to content

Commit

Permalink
Do not change the global state of the test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelfranca committed Jun 27, 2014
1 parent 9d21ef9 commit 3f596f8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions activerecord/test/schema/schema.rb
Expand Up @@ -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
Expand Down

0 comments on commit 3f596f8

Please sign in to comment.