aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/array_inquirer_test.rb
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2017-01-15 03:26:16 +0900
committerAkira Matsuda <ronnie@dio.jp>2017-01-15 03:31:24 +0900
commitb89316fed36096f28f998ec6490151d135695612 (patch)
tree6d315bf57d0eeaccd275b207a5acbd70e5601f49 /activesupport/test/array_inquirer_test.rb
parent31a95eda42e2111c1d8b02733901992fb340d0af (diff)
downloadrails-b89316fed36096f28f998ec6490151d135695612.tar.gz
rails-b89316fed36096f28f998ec6490151d135695612.tar.bz2
rails-b89316fed36096f28f998ec6490151d135695612.zip
This test wasn't actually an effective regression test
Diffstat (limited to 'activesupport/test/array_inquirer_test.rb')
-rw-r--r--activesupport/test/array_inquirer_test.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/activesupport/test/array_inquirer_test.rb b/activesupport/test/array_inquirer_test.rb
index 3ed48dd49d..3389f15884 100644
--- a/activesupport/test/array_inquirer_test.rb
+++ b/activesupport/test/array_inquirer_test.rb
@@ -40,16 +40,17 @@ class ArrayInquirerTest < ActiveSupport::TestCase
end
def test_respond_to_fallback_to_array_respond_to
- arr = ActiveSupport::ArrayInquirer.new([:x])
- # This kind of emulates a situation that Array#respond_to_missing? is defined
- arr.singleton_class.class_eval do
- def respond_to_missing?(name, _include_private = false)
+ Array.class_eval do
+ def respond_to_missing?(name, include_private = false)
(name == :foo) || super
end
end
+ arr = ActiveSupport::ArrayInquirer.new([:x])
assert_respond_to arr, :can_you_hear_me?
assert_respond_to arr, :foo
assert_not_respond_to arr, :nope
+ ensure
+ Array.send :undef_method, :respond_to_missing?
end
end