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

Commit 08da622

Browse files
JonRowepirj
authored andcommitted
Prevent JRuby build failure by sending to Kernel.require
1 parent 1624f7b commit 08da622

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/rspec/support.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@ module Support
1313
# it can resolve the file relative to one of the dirs.
1414
def self.define_optimized_require_for_rspec(lib, &require_relative)
1515
define_singleton_method("require_rspec_#{lib}") do |f|
16-
require_relative.call("#{lib}/#{f}")
16+
if RUBY_PLATFORM == 'java' && !Kernel.respond_to?(:require)
17+
# JRuby 9.1.17.0 has developed a regression for require
18+
(class << self; self; end).__send__(:define_method, name) do |f|
19+
Kernel.send(:require, "rspec/#{lib}/#{f}")
20+
end
21+
else
22+
require_relative.call("#{lib}/#{f}")
23+
end
1724
end
1825
end
1926

0 commit comments

Comments
 (0)