diff options
| -rw-r--r-- | spec/bundler/bundler/definition_spec.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/spec/bundler/bundler/definition_spec.rb b/spec/bundler/bundler/definition_spec.rb index c4a0f0cdb8..7bc48fce05 100644 --- a/spec/bundler/bundler/definition_spec.rb +++ b/spec/bundler/bundler/definition_spec.rb @@ -5,17 +5,16 @@ require "bundler/definition" RSpec.describe Bundler::Definition do describe "#lock" do before do - allow(Bundler).to receive(:settings) { Bundler::Settings.new(".") } - allow(Bundler::SharedHelpers).to receive(:find_gemfile) { Pathname.new("Gemfile") } + allow(Bundler::SharedHelpers).to receive(:find_gemfile) { bundled_app_gemfile } allow(Bundler).to receive(:ui) { double("UI", info: "", debug: "") } end - subject { Bundler::Definition.new("Gemfile.lock", [], Bundler::SourceList.new, {}) } + subject { Bundler::Definition.new(bundled_app_lock, [], Bundler::SourceList.new, {}) } context "when it's not possible to write to the file" do it "raises an PermissionError with explanation" do allow(File).to receive(:open).and_call_original - expect(File).to receive(:open).with("Gemfile.lock", "wb"). + expect(File).to receive(:open).with(bundled_app_lock, "wb"). and_raise(Errno::EACCES) expect { subject.lock }. to raise_error(Bundler::PermissionError, /Gemfile\.lock/) @@ -24,7 +23,7 @@ RSpec.describe Bundler::Definition do context "when a temporary resource access issue occurs" do it "raises a TemporaryResourceError with explanation" do allow(File).to receive(:open).and_call_original - expect(File).to receive(:open).with("Gemfile.lock", "wb"). + expect(File).to receive(:open).with(bundled_app_lock, "wb"). and_raise(Errno::EAGAIN) expect { subject.lock }. to raise_error(Bundler::TemporaryResourceError, /temporarily unavailable/) |
