diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-03-26 11:32:21 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-03-26 11:32:21 -0700 |
commit | 6289f455ae6c6d01aef34e46589e1d78c6f78190 (patch) | |
tree | af94a50ba6425249badbfa577675b0e20d3a3431 /activemodel/test | |
parent | e8b5c8eaf3a632e4f783ebee62f942ebbc70619a (diff) | |
download | rails-6289f455ae6c6d01aef34e46589e1d78c6f78190.tar.gz rails-6289f455ae6c6d01aef34e46589e1d78c6f78190.tar.bz2 rails-6289f455ae6c6d01aef34e46589e1d78c6f78190.zip |
test against ruby features in order to fix tests on Ruby 2.0
Diffstat (limited to 'activemodel/test')
-rw-r--r-- | activemodel/test/cases/attribute_methods_test.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/activemodel/test/cases/attribute_methods_test.rb b/activemodel/test/cases/attribute_methods_test.rb index 9406328d3e..34298d31c2 100644 --- a/activemodel/test/cases/attribute_methods_test.rb +++ b/activemodel/test/cases/attribute_methods_test.rb @@ -188,6 +188,12 @@ class AttributeMethodsTest < ActiveModel::TestCase assert_raises(NoMethodError) { m.protected_method } end + class ClassWithProtected + protected + def protected_method + end + end + test 'should not interfere with respond_to? if the attribute has a private/protected method' do m = ModelWithAttributes2.new m.attributes = { 'private_method' => '<3', 'protected_method' => 'O_o' } @@ -195,9 +201,11 @@ class AttributeMethodsTest < ActiveModel::TestCase assert !m.respond_to?(:private_method) assert m.respond_to?(:private_method, true) + c = ClassWithProtected.new + # This is messed up, but it's how Ruby works at the moment. Apparently it will be changed # in the future. - assert m.respond_to?(:protected_method) + assert_equal c.respond_to?(:protected_method), m.respond_to?(:protected_method) assert m.respond_to?(:protected_method, true) end |