Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #5820 from arunagw/more_ruby-2-0-fixes

Update test for Ruby 2 compatibility
  • Loading branch information...
commit e473e1f213db67adf67669030e8369596f898b5a 2 parents e0fd4fc + 96d81e5
Jeremy Kemper jeremy authored
Showing with 9 additions and 1 deletion.
  1. +9 −1 activemodel/test/cases/attribute_methods_test.rb
10 activemodel/test/cases/attribute_methods_test.rb
View
@@ -219,6 +219,12 @@ def foo
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 @@ def foo
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
Please sign in to comment.
Something went wrong with that request. Please try again.