diff options
author | wangjohn <wangjohn@mit.edu> | 2013-08-24 04:20:47 -0400 |
---|---|---|
committer | wangjohn <wangjohn@mit.edu> | 2013-08-24 14:22:07 -0400 |
commit | 16bc2d0e7ba61d7572829104c157534c69623fb1 (patch) | |
tree | 34a6eafa419ed0a66007ef967cb6afcb786cab99 /activerecord | |
parent | 8f7b3e166a3e5fe072263a5b7d4e115c1a49c2d4 (diff) | |
download | rails-16bc2d0e7ba61d7572829104c157534c69623fb1.tar.gz rails-16bc2d0e7ba61d7572829104c157534c69623fb1.tar.bz2 rails-16bc2d0e7ba61d7572829104c157534c69623fb1.zip |
Adding deprecation assertions for proper_table_name.
This prevents deprecation warnings from popping up.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/migration_test.rb | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index cbc9e96473..931caff727 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -322,11 +322,19 @@ class MigrationTest < ActiveRecord::TestCase end def test_proper_table_name_on_migrator - assert_equal "table", ActiveRecord::Migrator.proper_table_name('table') - assert_equal "table", ActiveRecord::Migrator.proper_table_name(:table) - assert_equal "reminders", ActiveRecord::Migrator.proper_table_name(Reminder) + assert_deprecated do + assert_equal "table", ActiveRecord::Migrator.proper_table_name('table') + end + assert_deprecated do + assert_equal "table", ActiveRecord::Migrator.proper_table_name(:table) + end + assert_deprecated do + assert_equal "reminders", ActiveRecord::Migrator.proper_table_name(Reminder) + end Reminder.reset_table_name - assert_equal Reminder.table_name, ActiveRecord::Migrator.proper_table_name(Reminder) + assert_deprecated do + assert_equal Reminder.table_name, ActiveRecord::Migrator.proper_table_name(Reminder) + end # Use the model's own prefix/suffix if a model is given ActiveRecord::Base.table_name_prefix = "ARprefix_" @@ -334,7 +342,9 @@ class MigrationTest < ActiveRecord::TestCase Reminder.table_name_prefix = 'prefix_' Reminder.table_name_suffix = '_suffix' Reminder.reset_table_name - assert_equal "prefix_reminders_suffix", ActiveRecord::Migrator.proper_table_name(Reminder) + assert_deprecated do + assert_equal "prefix_reminders_suffix", ActiveRecord::Migrator.proper_table_name(Reminder) + end Reminder.table_name_prefix = '' Reminder.table_name_suffix = '' Reminder.reset_table_name @@ -343,8 +353,12 @@ class MigrationTest < ActiveRecord::TestCase ActiveRecord::Base.table_name_prefix = "prefix_" ActiveRecord::Base.table_name_suffix = "_suffix" 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) + assert_deprecated do + assert_equal "prefix_table_suffix", ActiveRecord::Migrator.proper_table_name('table') + end + assert_deprecated do + assert_equal "prefix_table_suffix", ActiveRecord::Migrator.proper_table_name(:table) + end end def test_proper_table_name_on_migration |