diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-08-21 07:50:35 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-08-21 07:50:35 -0700 |
commit | ace06925284786cf884a93d36d0739eb49fac789 (patch) | |
tree | 74443d08eb3e02752d39a1d19de00d85d8bf0b66 /activerecord/test | |
parent | 55d943c5670997ce64744c1ae3cd0426f5517b10 (diff) | |
parent | 57bef99073fc2e3e30694bf1fb1a3c04a63bfcff (diff) | |
download | rails-ace06925284786cf884a93d36d0739eb49fac789.tar.gz rails-ace06925284786cf884a93d36d0739eb49fac789.tar.bz2 rails-ace06925284786cf884a93d36d0739eb49fac789.zip |
Merge pull request #7000 from kennyj/fix_6697-3
Use instance_accessor: false instead of instance_writer.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/base_test.rb | 6 | ||||
-rw-r--r-- | activerecord/test/cases/serialization_test.rb | 7 | ||||
-rw-r--r-- | activerecord/test/cases/store_test.rb | 5 |
3 files changed, 11 insertions, 7 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 04b1d75e3e..63981a68a9 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -604,6 +604,12 @@ class BasicsTest < ActiveRecord::TestCase assert_equal "changed", post.body end + def test_attr_readonly_is_class_level_setting + post = ReadonlyTitlePost.new + assert_raise(NoMethodError) { post._attr_readonly = [:title] } + assert_deprecated { post._attr_readonly } + end + def test_non_valid_identifier_column_name weird = Weird.create('a$b' => 'value') weird.reload diff --git a/activerecord/test/cases/serialization_test.rb b/activerecord/test/cases/serialization_test.rb index ce167509c1..10d8ccc711 100644 --- a/activerecord/test/cases/serialization_test.rb +++ b/activerecord/test/cases/serialization_test.rb @@ -53,9 +53,8 @@ class SerializationTest < ActiveRecord::TestCase end def test_serialized_attributes_are_class_level_settings - assert_raise NoMethodError do - topic = Topic.new - topic.serialized_attributes = [] - end + topic = Topic.new + assert_raise(NoMethodError) { topic.serialized_attributes = [] } + assert_deprecated { topic.serialized_attributes } end end diff --git a/activerecord/test/cases/store_test.rb b/activerecord/test/cases/store_test.rb index 3e60b62fd5..fb0d116c08 100644 --- a/activerecord/test/cases/store_test.rb +++ b/activerecord/test/cases/store_test.rb @@ -122,9 +122,8 @@ class StoreTest < ActiveRecord::TestCase end test "stores_attributes are class level settings" do - assert_raise NoMethodError do - @john.stored_attributes = {} - end + assert_raise(NoMethodError) { @john.stored_attributes = Hash.new } + assert_raise(NoMethodError) { @john.stored_attributes } end end |