aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/migrator_test.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2019-06-11 19:57:38 +0900
committerRyuta Kamizono <kamipo@gmail.com>2019-06-13 13:15:50 +0900
commit5cab344494c340ea82a35b46efa06b94f0b7730b (patch)
treeec5e8e67eeff1693a8bf2a3395bceea397894e27 /activerecord/test/cases/migrator_test.rb
parent0ad238f4782375ea2d3e0145c74be1d1aa8f546f (diff)
downloadrails-5cab344494c340ea82a35b46efa06b94f0b7730b.tar.gz
rails-5cab344494c340ea82a35b46efa06b94f0b7730b.tar.bz2
rails-5cab344494c340ea82a35b46efa06b94f0b7730b.zip
Clear schema cache when a table is created/dropped/renamed
Otherwise `Model.table_exists?` returns the staled cache result.
Diffstat (limited to 'activerecord/test/cases/migrator_test.rb')
-rw-r--r--activerecord/test/cases/migrator_test.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/test/cases/migrator_test.rb b/activerecord/test/cases/migrator_test.rb
index 30e199f1c5..0c2ff95099 100644
--- a/activerecord/test/cases/migrator_test.rb
+++ b/activerecord/test/cases/migrator_test.rb
@@ -429,10 +429,10 @@ class MigratorTest < ActiveRecord::TestCase
_, migrator = migrator_class(3)
migrator = migrator.new("valid")
- ActiveRecord::Base.connection.drop_table "schema_migrations", if_exists: true
- assert_not ActiveRecord::Base.connection.table_exists?("schema_migrations")
+ ActiveRecord::SchemaMigration.drop_table
+ assert_not_predicate ActiveRecord::SchemaMigration, :table_exists?
migrator.migrate(1)
- assert ActiveRecord::Base.connection.table_exists?("schema_migrations")
+ assert_predicate ActiveRecord::SchemaMigration, :table_exists?
end
def test_migrator_forward