blob: 076f2c863251d2ee2b91bcc495ac2f0872ec00a6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
require "spec_helper"
require "bundler/definition"
describe Bundler::Definition do
before do
allow(Bundler).to receive(:settings) { Bundler::Settings.new(".") }
allow(Bundler).to receive(:default_gemfile) { Pathname.new("Gemfile") }
allow(Bundler).to receive(:ui) { double("UI", :info => "") }
end
describe "#lock" do
context "when it's not possible to write to the file" do
subject { Bundler::Definition.new(nil, [], Bundler::SourceList.new, []) }
it "raises an PermissionError with explanation" do
expect(File).to receive(:open).with("Gemfile.lock", "wb").
and_raise(Errno::EACCES)
expect { subject.lock("Gemfile.lock") }.
to raise_error(Bundler::PermissionError, /Gemfile\.lock/)
end
end
end
end
|