From 54e1ed20f95fad747be5d0b15c81cd9a1ce20a9e Mon Sep 17 00:00:00 2001 From: Carson McDonald Date: Sat, 20 Apr 2013 07:47:58 -0400 Subject: Add a test for respond_to_missing? --- test/t/kernel.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/t') diff --git a/test/t/kernel.rb b/test/t/kernel.rb index abc8f260b..f2f387bb2 100644 --- a/test/t/kernel.rb +++ b/test/t/kernel.rb @@ -392,3 +392,16 @@ assert('Kernel#!=') do (str1 != str3) == true and (str2 != str1) == false end + +assert('Kernel#respond_to_missing?') do + + class Test4RespondToMissing + def respond_to_missing?(method_name, include_private = false) + method_name == :a_method + end + end + + Test4RespondToMissing.new.respond_to?(:a_method) == true and + Test4RespondToMissing.new.respond_to?(:no_method) == false + +end -- cgit v1.2.3