diff options
Diffstat (limited to 'activerecord/test/cases/base_test.rb')
-rw-r--r-- | activerecord/test/cases/base_test.rb | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 062cac7d52..8d16103672 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -1498,17 +1498,41 @@ class BasicsTest < ActiveRecord::TestCase k = Class.new( ActiveRecord::Base ) k.primary_key = "foo" assert_equal "foo", k.primary_key - k.set_primary_key "bar" + + assert_deprecated do + k.set_primary_key "bar" + end assert_equal "bar", k.primary_key end def test_set_primary_key_with_block k = Class.new( ActiveRecord::Base ) k.primary_key = 'id' - k.set_primary_key { "sys_" + original_primary_key } + + assert_deprecated do + k.set_primary_key { "sys_" + original_primary_key } + end assert_equal "sys_id", k.primary_key end + def test_original_primary_key + k = Class.new(ActiveRecord::Base) + def k.name; "Foo"; end + k.primary_key = "bar" + + assert_deprecated do + assert_equal "id", k.original_primary_key + end + + k = Class.new(ActiveRecord::Base) + k.primary_key = "omg" + k.primary_key = "wtf" + + assert_deprecated do + assert_equal "omg", k.original_primary_key + end + end + def test_set_inheritance_column_with_value k = Class.new( ActiveRecord::Base ) k.inheritance_column = "foo" |