summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKJ Tsanaktsidis <ktsanaktsidis@zendesk.com>2024-08-23 16:21:26 +1000
committergit <svn-admin@ruby-lang.org>2024-08-23 08:08:26 +0000
commit4dae4c6858bb57053ce1e8174e2d52b8288cf7c9 (patch)
tree671ae118a67784490c19cb7694d4fb06aeb0d2c5
parent73a946c61850314264cc47f2414e571921d59fde (diff)
[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
-rw-r--r--spec/bundler/bundler/bundler_spec.rb1
1 files changed, 1 insertions, 0 deletions
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"))