aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2016-02-24 11:35:29 -0300
committerRafael França <rafaelmfranca@gmail.com>2016-02-24 11:35:29 -0300
commit177e1bb955dc117c305b8afcbc6c327279da304a (patch)
treecb68520a4d165c900c4e91897571883904c89a0c
parenta75f66f7e6909d331f1dc39efd1827bde6e53500 (diff)
parent95441c7b3b0ec6ca00e01e160df02941d321f684 (diff)
downloadrails-177e1bb955dc117c305b8afcbc6c327279da304a.tar.gz
rails-177e1bb955dc117c305b8afcbc6c327279da304a.tar.bz2
rails-177e1bb955dc117c305b8afcbc6c327279da304a.zip
Merge pull request #23853 from kamipo/ensure_drop_table
Ensure `drop_table` even if tests failure or interrupted
-rw-r--r--activerecord/test/cases/migration_test.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb
index c88e8d4a8b..6a6250eec3 100644
--- a/activerecord/test/cases/migration_test.rb
+++ b/activerecord/test/cases/migration_test.rb
@@ -516,13 +516,12 @@ class MigrationTest < ActiveRecord::TestCase
data_column = columns.detect { |c| c.name == "data" }
assert_nil data_column.default
-
+ ensure
Person.connection.drop_table :binary_testings, if_exists: true
end
unless mysql_enforcing_gtid_consistency?
def test_create_table_with_query
- Person.connection.drop_table :table_from_query_testings rescue nil
Person.connection.create_table(:person, force: true)
Person.connection.create_table :table_from_query_testings, as: "SELECT id FROM person"
@@ -530,12 +529,11 @@ class MigrationTest < ActiveRecord::TestCase
columns = Person.connection.columns(:table_from_query_testings)
assert_equal 1, columns.length
assert_equal "id", columns.first.name
-
+ ensure
Person.connection.drop_table :table_from_query_testings rescue nil
end
def test_create_table_with_query_from_relation
- Person.connection.drop_table :table_from_query_testings rescue nil
Person.connection.create_table(:person, force: true)
Person.connection.create_table :table_from_query_testings, as: Person.select(:id)
@@ -543,7 +541,7 @@ class MigrationTest < ActiveRecord::TestCase
columns = Person.connection.columns(:table_from_query_testings)
assert_equal 1, columns.length
assert_equal "id", columns.first.name
-
+ ensure
Person.connection.drop_table :table_from_query_testings rescue nil
end
end
@@ -731,7 +729,7 @@ class ReservedWordsMigrationTest < ActiveRecord::TestCase
connection.add_index :values, :value
connection.remove_index :values, :column => :value
end
-
+ ensure
connection.drop_table :values rescue nil
end
end
@@ -747,7 +745,7 @@ class ExplicitlyNamedIndexMigrationTest < ActiveRecord::TestCase
connection.add_index :values, :value, name: 'a_different_name'
connection.remove_index :values, column: :value, name: 'a_different_name'
end
-
+ ensure
connection.drop_table :values rescue nil
end
end