diff --git a/spec/bundler/definition_spec.rb b/spec/bundler/definition_spec.rb index 2ed87ec81dc..ceb7b4bf05b 100644 --- a/spec/bundler/definition_spec.rb +++ b/spec/bundler/definition_spec.rb @@ -13,6 +13,7 @@ subject { Bundler::Definition.new(nil, [], Bundler::SourceList.new, []) } it "raises an PermissionError with explanation" do + allow(File).to receive(:open).and_call_original expect(File).to receive(:open).with("Gemfile.lock", "wb"). and_raise(Errno::EACCES) expect { subject.lock("Gemfile.lock") }. @@ -23,6 +24,7 @@ subject { Bundler::Definition.new(nil, [], Bundler::SourceList.new, []) } it "raises a TemporaryResourceError with explanation" do + allow(File).to receive(:open).and_call_original expect(File).to receive(:open).with("Gemfile.lock", "wb"). and_raise(Errno::EAGAIN) expect { subject.lock("Gemfile.lock") }.