Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

JRuby fix #2858

Merged
merged 1 commit into from
Jan 30, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions spec/support/aruba_support.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
if RSpec::Support::Ruby.jruby? && RSpec::Support::Ruby.jruby_version == "9.1.17.0"
# A regression appeared in require_relative in JRuby 9.1.17.0 where require some
# how ends up private, this monkey patch uses `send`
module Kernel
module_function
def require_relative(relative_arg)
relative_arg = relative_arg.to_path if relative_arg.respond_to? :to_path
relative_arg = JRuby::Type.convert_to_str(relative_arg)

caller.first.rindex(/:\d+:in /)
file = $` # just the filename
raise LoadError, "cannot infer basepath" if /\A\((.*)\)/ =~ file # eval etc.

absolute_feature = File.expand_path(relative_arg, File.dirname(File.realpath(file)))

# This was the orginal:
# ::Kernel.require absolute_feature
::Kernel.send(:require, absolute_feature)
end
end
end

module ArubaLoader
extend RSpec::Support::WithIsolatedStdErr
with_isolated_stderr do
Expand Down