diff options
author | Akira Matsuda <ronnie@dio.jp> | 2013-01-09 15:05:10 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2013-01-22 05:24:23 +0900 |
commit | 2c613f9d370d5de9eef22d57ba0e6a796579df3f (patch) | |
tree | 840da9e18e1e2e25240ceee1b3df9c097b74a654 /activerecord | |
parent | 59e2630ca7570deeb503713986681cf1f2e317ec (diff) | |
download | rails-2c613f9d370d5de9eef22d57ba0e6a796579df3f.tar.gz rails-2c613f9d370d5de9eef22d57ba0e6a796579df3f.tar.bz2 rails-2c613f9d370d5de9eef22d57ba0e6a796579df3f.zip |
Reset table_name_{prefix,suffix}, and table_name after each test
because some tests were not resetting them, and thus the tests were order dependent
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/migration_test.rb | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index 187c6e8447..cb9130f846 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -33,6 +33,9 @@ class MigrationTest < ActiveRecord::TestCase end def teardown + ActiveRecord::Base.table_name_prefix = "" + ActiveRecord::Base.table_name_suffix = "" + ActiveRecord::Base.connection.initialize_schema_migrations_table ActiveRecord::Base.connection.execute "DELETE FROM #{ActiveRecord::Migrator.schema_migrations_table_name}" @@ -44,6 +47,7 @@ class MigrationTest < ActiveRecord::TestCase %w(reminders people_reminders prefix_reminders_suffix).each do |table| Reminder.connection.drop_table(table) rescue nil end + Reminder.reset_table_name Reminder.reset_column_information %w(last_name key bio age height wealth birthday favorite_day @@ -257,9 +261,6 @@ class MigrationTest < ActiveRecord::TestCase ActiveRecord::Base.table_name_suffix = "" Reminder.reset_table_name assert_equal "schema_migrations", ActiveRecord::Migrator.schema_migrations_table_name - ensure - ActiveRecord::Base.table_name_prefix = "" - ActiveRecord::Base.table_name_suffix = "" end def test_proper_table_name @@ -286,9 +287,6 @@ class MigrationTest < ActiveRecord::TestCase Reminder.reset_table_name assert_equal "prefix_table_suffix", ActiveRecord::Migrator.proper_table_name('table') assert_equal "prefix_table_suffix", ActiveRecord::Migrator.proper_table_name(:table) - ActiveRecord::Base.table_name_prefix = "" - ActiveRecord::Base.table_name_suffix = "" - Reminder.reset_table_name end def test_rename_table_with_prefix_and_suffix @@ -307,8 +305,6 @@ class MigrationTest < ActiveRecord::TestCase assert_equal "hello world", Thing.first.content ensure - ActiveRecord::Base.table_name_prefix = '' - ActiveRecord::Base.table_name_suffix = '' Thing.reset_table_name Thing.reset_sequence_name end @@ -326,9 +322,6 @@ class MigrationTest < ActiveRecord::TestCase WeNeedReminders.down assert_raise(ActiveRecord::StatementInvalid) { Reminder.first } ensure - ActiveRecord::Base.table_name_prefix = '' - ActiveRecord::Base.table_name_suffix = '' - Reminder.reset_table_name Reminder.reset_sequence_name end |