diff options
author | Andrew White <pixeltrix@users.noreply.github.com> | 2015-10-21 16:34:50 +0100 |
---|---|---|
committer | Andrew White <pixeltrix@users.noreply.github.com> | 2015-10-21 16:34:50 +0100 |
commit | 1d16d8102a2b53d3ddced10050d700fe16ca0ef7 (patch) | |
tree | c794b8303a486432e8ddf057c82259f0e904369f /activesupport/test | |
parent | 173fc1f7beed616adc840e02fef4e7f93e877c69 (diff) | |
parent | 94ca3e0a571dba0fe41ca18d61634c5f3aa11209 (diff) | |
download | rails-1d16d8102a2b53d3ddced10050d700fe16ca0ef7.tar.gz rails-1d16d8102a2b53d3ddced10050d700fe16ca0ef7.tar.bz2 rails-1d16d8102a2b53d3ddced10050d700fe16ca0ef7.zip |
Merge pull request #20026 from rails/remove-possible-singleton-method
Fix warnings in multiple application tests
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/module/remove_method_test.rb | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/activesupport/test/core_ext/module/remove_method_test.rb b/activesupport/test/core_ext/module/remove_method_test.rb index 4657f0c175..77774afb0d 100644 --- a/activesupport/test/core_ext/module/remove_method_test.rb +++ b/activesupport/test/core_ext/module/remove_method_test.rb @@ -6,19 +6,31 @@ module RemoveMethodTests def do_something return 1 end - + + class << self + def do_something_else + return 2 + end + end end end class RemoveMethodTest < ActiveSupport::TestCase - + def test_remove_method_from_an_object RemoveMethodTests::A.class_eval{ self.remove_possible_method(:do_something) } assert !RemoveMethodTests::A.new.respond_to?(:do_something) end - + + def test_remove_singleton_method_from_an_object + RemoveMethodTests::A.class_eval{ + self.remove_possible_singleton_method(:do_something_else) + } + assert !RemoveMethodTests::A.respond_to?(:do_something_else) + end + def test_redefine_method_in_an_object RemoveMethodTests::A.class_eval{ self.redefine_method(:do_something) { return 100 } |