diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2017-06-07 10:56:14 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2017-06-09 07:56:45 +0900 |
commit | cac0c7924db46474b0554f8da5b196d4fd9d9ed6 (patch) | |
tree | 1a80c51a3aaf9835259e3f45f5d7860d82c77409 /activerecord/test/cases/adapters/mysql2 | |
parent | b7d244f52add490da2fec993772089baed0dab98 (diff) | |
download | rails-cac0c7924db46474b0554f8da5b196d4fd9d9ed6.tar.gz rails-cac0c7924db46474b0554f8da5b196d4fd9d9ed6.tar.bz2 rails-cac0c7924db46474b0554f8da5b196d4fd9d9ed6.zip |
Insert environment value to `InternalMetadata` after recreating the table
Sometimes `ActiveRecord::DatabaseTasksUtilsTask#test_raises_an_error_when_called_with_protected_environment`
test fails.
https://travis-ci.org/rails/rails/jobs/238861562
https://travis-ci.org/rails/rails/jobs/239950092
There seems to be an error because `environment` value is not exist.
This is because did not set the environment after recreating the
table in `SchemaMigrationsTest#test_initializes_internal_metadata_for_encoding_utf8mb4`.
Therefore, we create value after the test to maintain the original state.
Diffstat (limited to 'activerecord/test/cases/adapters/mysql2')
-rw-r--r-- | activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb b/activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb index 251a50e41e..e7459546e4 100644 --- a/activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb +++ b/activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb @@ -1,6 +1,8 @@ require "cases/helper" class SchemaMigrationsTest < ActiveRecord::Mysql2TestCase + self.use_transactional_tests = false + def test_renaming_index_on_foreign_key connection.add_index "engines", "car_id" connection.add_foreign_key :engines, :cars, name: "fk_engines_cars" @@ -31,6 +33,8 @@ class SchemaMigrationsTest < ActiveRecord::Mysql2TestCase assert connection.column_exists?(table_name, :key, :string) end + ensure + ActiveRecord::InternalMetadata[:environment] = ActiveRecord::Migrator.current_environment end private |