From c9213aa864fb8527388679c21f1ea8ce129e2f1a Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sat, 2 May 2020 16:03:14 +0200 Subject: Update to ruby/spec@d394dfd --- spec/ruby/core/kernel/require_relative_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'spec/ruby/core/kernel/require_relative_spec.rb') diff --git a/spec/ruby/core/kernel/require_relative_spec.rb b/spec/ruby/core/kernel/require_relative_spec.rb index b292a46c63..d4146eb3c8 100644 --- a/spec/ruby/core/kernel/require_relative_spec.rb +++ b/spec/ruby/core/kernel/require_relative_spec.rb @@ -90,6 +90,16 @@ describe "Kernel#require_relative with a relative path" do ScratchPad.recorded.should == [] end + it "raises a LoadError that includes the missing path" do + missing_path = "#{@dir}/nonexistent.rb" + expanded_missing_path = File.expand_path(missing_path, File.dirname(__FILE__)) + -> { require_relative(missing_path) }.should raise_error(LoadError) { |e| + e.message.should include(expanded_missing_path) + e.path.should == expanded_missing_path + } + ScratchPad.recorded.should == [] + end + it "raises a LoadError if basepath does not exist" do -> { eval("require_relative('#{@dir}/nonexistent.rb')") }.should raise_error(LoadError) end -- cgit v1.2.3