diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-06-23 09:48:47 -0600 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-06-23 09:54:06 -0600 |
commit | ae96f229f6501d8635811d6b22d75d43cdb880a4 (patch) | |
tree | 57d224d09a4617f74b3ef980cf92173806765020 /activerecord/test | |
parent | 936fd4c1e017ec88699b3cd7daa09847da36c731 (diff) | |
download | rails-ae96f229f6501d8635811d6b22d75d43cdb880a4.tar.gz rails-ae96f229f6501d8635811d6b22d75d43cdb880a4.tar.bz2 rails-ae96f229f6501d8635811d6b22d75d43cdb880a4.zip |
Add a deprecation cycle for `NullColumn` from `column_for_attribute`
This is public API, and `simple_form` depends on the `nil` return value.
We need to go through a deprecation cycle to return a null object. If
people want hash access, they can access the hash.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/reflection_test.rb | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/activerecord/test/cases/reflection_test.rb b/activerecord/test/cases/reflection_test.rb index c6e73f78cc..acbd065649 100644 --- a/activerecord/test/cases/reflection_test.rb +++ b/activerecord/test/cases/reflection_test.rb @@ -80,24 +80,10 @@ class ReflectionTest < ActiveRecord::TestCase assert_equal :integer, @first.column_for_attribute("id").type end - def test_non_existent_columns_return_null_object - column = @first.column_for_attribute("attribute_that_doesnt_exist") - assert_instance_of ActiveRecord::ConnectionAdapters::NullColumn, column - assert_equal "attribute_that_doesnt_exist", column.name - assert_equal nil, column.sql_type - assert_equal nil, column.type - assert_not column.number? - assert_not column.text? - assert_not column.binary? - end - - def test_non_existent_columns_are_identity_types - column = @first.column_for_attribute("attribute_that_doesnt_exist") - object = Object.new - - assert_equal object, column.type_cast_from_database(object) - assert_equal object, column.type_cast_from_user(object) - assert_equal object, column.type_cast_for_database(object) + def test_non_existent_columns_return_nil + assert_deprecated do + assert_nil @first.column_for_attribute("attribute_that_doesnt_exist") + end end def test_reflection_klass_for_nested_class_name |