diff --git a/test/irb/test_command.rb b/test/irb/test_command.rb index 567c3216c..69931e3e4 100644 --- a/test/irb/test_command.rb +++ b/test/irb/test_command.rb @@ -765,7 +765,7 @@ def test_show_doc ensure # this is the only way to reset the redefined method without coupling the test with its implementation EnvUtil.suppress_warning { load "irb/command/help.rb" } - end + end if defined?(RDoc) def test_show_doc_without_rdoc _, err = without_rdoc do diff --git a/test/irb/test_input_method.rb b/test/irb/test_input_method.rb index 9d0f393ce..915297f56 100644 --- a/test/irb/test_input_method.rb +++ b/test/irb/test_input_method.rb @@ -1,7 +1,10 @@ # frozen_string_literal: false require "irb" -require "rdoc" +begin + require "rdoc" +rescue LoadError +end require_relative "helper" module TestIRB @@ -188,4 +191,4 @@ def has_rdoc_content? File.exist?(RDoc::RI::Paths::BASE) end end -end +end if defined?(RDoc)