diff options
author | Jean Boussier <jean.boussier@gmail.com> | 2015-09-22 14:10:38 -0400 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2015-09-24 11:04:44 -0400 |
commit | 4ccdd4122dfdab200c02f78a994f4112d6164164 (patch) | |
tree | 298ca6c3f0a593cb55f9fe90c4f69b7647d43e94 /activerecord/test/cases | |
parent | 4a375a83deab7a3089e718a1d18ddc4c2846cd40 (diff) | |
download | rails-4ccdd4122dfdab200c02f78a994f4112d6164164.tar.gz rails-4ccdd4122dfdab200c02f78a994f4112d6164164.tar.bz2 rails-4ccdd4122dfdab200c02f78a994f4112d6164164.zip |
Implement ActiveRecord::Base.ignored_columns
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/base_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 991145bed4..d6c48b99f3 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -1571,4 +1571,22 @@ class BasicsTest < ActiveRecord::TestCase assert_not topic.id_changed? end + + test "ignored columns are not present in columns_hash" do + cache_columns = Developer.connection.schema_cache.columns_hash(Developer.table_name) + assert_includes cache_columns.keys, 'first_name' + refute_includes Developer.columns_hash.keys, 'first_name' + end + + test "ignored columns have no attirbute methods" do + refute Developer.new.respond_to?(:first_name) + refute Developer.new.respond_to?(:first_name=) + refute Developer.new.respond_to?(:first_name?) + end + + test "ignored columns don't prevent explicit declaration of attribute methods" do + assert Developer.new.respond_to?(:last_name) + assert Developer.new.respond_to?(:last_name=) + assert Developer.new.respond_to?(:last_name?) + end end |