diff options
author | Anand <lucky.developer@gmail.com> | 2011-11-07 16:22:52 +0530 |
---|---|---|
committer | Anand <lucky.developer@gmail.com> | 2011-11-07 16:22:52 +0530 |
commit | aabd61af8eca03ab7e627ca532c17f0a314984ca (patch) | |
tree | b7fbac3e40b68480ba943b82cbd906fb69682fe3 /activesupport/test/core_ext | |
parent | 4cef581fcf83f161edcd681bbda1461d5f7d5f33 (diff) | |
download | rails-aabd61af8eca03ab7e627ca532c17f0a314984ca.tar.gz rails-aabd61af8eca03ab7e627ca532c17f0a314984ca.tar.bz2 rails-aabd61af8eca03ab7e627ca532c17f0a314984ca.zip |
added remove_method core_ext tests
Diffstat (limited to 'activesupport/test/core_ext')
-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 |