From 4dae4c6858bb57053ce1e8174e2d52b8288cf7c9 Mon Sep 17 00:00:00 2001 From: KJ Tsanaktsidis Date: Fri, 23 Aug 2024 16:21:26 +1000 Subject: [PATCH] [rubygems/rubygems] Don't break if extra calls to File.writable? happen In https://bugs.ruby-lang.org/issues/20693, I'd like to have Dir.tmpdir call `File.writable?` instead of `Stat#writable?`. However, that causes this test to break in bundler because it's using RSpec to stub `File.writable?`. We can fix this by allowing the real `File.writable?` to be called for all files except the directory we're trying to stub. https://github.com/rubygems/rubygems/commit/0fa6657293 --- spec/bundler/bundler/bundler_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/bundler/bundler/bundler_spec.rb b/spec/bundler/bundler/bundler_spec.rb index 2c8453da4d..7cfc12a6f6 100644 --- a/spec/bundler/bundler/bundler_spec.rb +++ b/spec/bundler/bundler/bundler_spec.rb @@ -267,6 +267,7 @@ RSpec.describe Bundler do it "should issue a warning and return a temporary user home" do allow(Bundler.rubygems).to receive(:user_home).and_return(path) allow(File).to receive(:directory?).with(path).and_return true + allow(File).to receive(:writable?).and_call_original allow(File).to receive(:writable?).with(path).and_return false allow(File).to receive(:directory?).with(dotbundle).and_return false allow(Bundler).to receive(:tmp).and_return(Pathname.new("/tmp/trulyrandom"))