Skip to content
This repository
Browse code

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 authored April 12, 2012
10  activemodel/test/cases/attribute_methods_test.rb
@@ -219,6 +219,12 @@ def foo
219 219
     assert_raises(NoMethodError) { m.protected_method }
220 220
   end
221 221
 
  222
+  class ClassWithProtected
  223
+    protected
  224
+    def protected_method
  225
+    end
  226
+  end
  227
+
222 228
   test 'should not interfere with respond_to? if the attribute has a private/protected method' do
223 229
     m = ModelWithAttributes2.new
224 230
     m.attributes = { 'private_method' => '<3', 'protected_method' => 'O_o' }
@@ -226,9 +232,11 @@ def foo
226 232
     assert !m.respond_to?(:private_method)
227 233
     assert m.respond_to?(:private_method, true)
228 234
 
  235
+    c = ClassWithProtected.new
  236
+
229 237
     # This is messed up, but it's how Ruby works at the moment. Apparently it will be changed
230 238
     # in the future.
231  
-    assert m.respond_to?(:protected_method)
  239
+    assert_equal c.respond_to?(:protected_method), m.respond_to?(:protected_method)
232 240
     assert m.respond_to?(:protected_method, true)
233 241
   end
234 242
 

0 notes on commit e473e1f

Please sign in to comment.
Something went wrong with that request. Please try again.