aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-06-27 17:32:38 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-06-27 17:32:38 -0300
commit3f596f8ad37bcebbccbc51ee0190d2949abdc69d (patch)
tree830ef126700bd501a0afc73c3820d1daec0c2889 /activerecord
parent9d21ef9388cd16a9c1e8d356a1ba15895451c873 (diff)
downloadrails-3f596f8ad37bcebbccbc51ee0190d2949abdc69d.tar.gz
rails-3f596f8ad37bcebbccbc51ee0190d2949abdc69d.tar.bz2
rails-3f596f8ad37bcebbccbc51ee0190d2949abdc69d.zip
Do not change the global state of the test suite
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/associations/belongs_to_associations_test.rb19
-rw-r--r--activerecord/test/schema/schema.rb1
2 files changed, 2 insertions, 18 deletions
diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb
index 1a0f447ec2..4238681905 100644
--- a/activerecord/test/cases/associations/belongs_to_associations_test.rb
+++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb
@@ -938,26 +938,9 @@ end
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
diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb
index 03d33c151a..be134fde11 100644
--- a/activerecord/test/schema/schema.rb
+++ b/activerecord/test/schema/schema.rb
@@ -83,6 +83,7 @@ ActiveRecord::Schema.define do
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