aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2012-04-12 05:57:52 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2012-04-12 05:57:52 -0700
commite473e1f213db67adf67669030e8369596f898b5a (patch)
tree983fc078f373ec3b02f91444afd490b0112f1e89
parente0fd4fc9e2867ee991df66ab1e704f69377cb9c5 (diff)
parent96d81e5df4e9935c85dc68d45d8381f583b92e3a (diff)
downloadrails-e473e1f213db67adf67669030e8369596f898b5a.tar.gz
rails-e473e1f213db67adf67669030e8369596f898b5a.tar.bz2
rails-e473e1f213db67adf67669030e8369596f898b5a.zip
Merge pull request #5820 from arunagw/more_ruby-2-0-fixes
Update test for Ruby 2 compatibility
-rw-r--r--activemodel/test/cases/attribute_methods_test.rb10
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 ff60100c08..e770728fd5 100644
--- a/activemodel/test/cases/attribute_methods_test.rb
+++ b/activemodel/test/cases/attribute_methods_test.rb
@@ -219,6 +219,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' }
@@ -226,9 +232,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