summaryrefslogtreecommitdiff
path: root/spec/bundler/definition_spec.rb
blob: 034a571314289366088f90581f3f18a0af9513bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
require 'spec_helper'
require 'bundler/definition'

describe Bundler::Definition do
  before do
    Bundler.stub(:settings){ Bundler::Settings.new(".") }
  end

  describe "#lock" do
    context "when it's not possible to write to the file" do
      subject{ Bundler::Definition.new(nil, [], [], []) }

      before do
        File.should_receive(:open).with("Gemfile.lock", "wb").
          and_raise(Errno::EACCES)
      end

      it "raises an InstallError with explanation" do
        expect{ subject.lock("Gemfile.lock") }.
          to raise_error(Bundler::InstallError)
      end
    end
  end

end