Skip to content

Commit 52b7980

Browse files
luke-grust0012
authored andcommitted
Fix 2 minor issues in test suite
* undefine Kernel#irb_original_require in without_rdoc method * Don't rescue all LoadErrors/NameErrors in test_rendering.rb, just the one for require 'yamatanooroti'
1 parent 92086b3 commit 52b7980

File tree

2 files changed

+237
-233
lines changed

2 files changed

+237
-233
lines changed

test/irb/helper.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ def restore_encodings
5757
end
5858

5959
def without_rdoc(&block)
60-
::Kernel.send(:alias_method, :old_require, :require)
60+
::Kernel.send(:alias_method, :irb_original_require, :require)
6161

6262
::Kernel.define_method(:require) do |name|
6363
raise LoadError, "cannot load such file -- rdoc (test)" if name.match?("rdoc") || name.match?(/^rdoc\/.*/)
64-
::Kernel.send(:old_require, name)
64+
::Kernel.send(:irb_original_require, name)
6565
end
6666

6767
yield
@@ -70,7 +70,10 @@ def without_rdoc(&block)
7070
require_relative "../lib/envutil"
7171
rescue LoadError # ruby/ruby defines EnvUtil differently
7272
end
73-
EnvUtil.suppress_warning { ::Kernel.send(:alias_method, :require, :old_require) }
73+
EnvUtil.suppress_warning {
74+
::Kernel.send(:alias_method, :require, :irb_original_require)
75+
::Kernel.undef_method :irb_original_require
76+
}
7477
end
7578
end
7679
end

0 commit comments

Comments
 (0)