diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-11-07 03:02:26 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-11-07 03:02:26 -0800 |
commit | 6a29ea04ae78d88f4756e6ebe48b8e9ee999143f (patch) | |
tree | 3b377422a60e2819a489aa0439ea850749462074 /activesupport/test/core_ext/module | |
parent | 17ecdd388c70f7faf002ef21be6a674b4c0df7ca (diff) | |
parent | aabd61af8eca03ab7e627ca532c17f0a314984ca (diff) | |
download | rails-6a29ea04ae78d88f4756e6ebe48b8e9ee999143f.tar.gz rails-6a29ea04ae78d88f4756e6ebe48b8e9ee999143f.tar.bz2 rails-6a29ea04ae78d88f4756e6ebe48b8e9ee999143f.zip |
Merge pull request #3549 from luckydev/rmethod
remove_method tests and changes
Diffstat (limited to 'activesupport/test/core_ext/module')
-rw-r--r-- | activesupport/test/core_ext/module/remove_method_test.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/module/remove_method_test.rb b/activesupport/test/core_ext/module/remove_method_test.rb new file mode 100644 index 0000000000..4657f0c175 --- /dev/null +++ b/activesupport/test/core_ext/module/remove_method_test.rb @@ -0,0 +1,29 @@ +require 'abstract_unit' +require 'active_support/core_ext/module/remove_method' + +module RemoveMethodTests + class A + def do_something + return 1 + 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_redefine_method_in_an_object + RemoveMethodTests::A.class_eval{ + self.redefine_method(:do_something) { return 100 } + } + assert_equal 100, RemoveMethodTests::A.new.do_something + end + +end
\ No newline at end of file |