aboutsummaryrefslogtreecommitdiffstats
path: root/spec/install/force_spec.rb
blob: 2027660cbadd470cba6ccce4a223909ad549626b (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
26
27
28
29
30
31
32
33
34
35
36
# frozen_string_literal: true
require "spec_helper"

describe "bundle install" do
  describe "with --force" do
    before :each do
      gemfile <<-G
        source "file://#{gem_repo1}"
        gem "rack"
      G
    end

    it "re-installs installed gems" do
      rack_lib = default_bundle_path("gems/rack-1.0.0/lib/rack.rb")

      bundle "install"
      rack_lib.open("w") {|f| f.write("blah blah blah") }
      bundle "install --force"

      expect(exitstatus).to eq(0) if exitstatus
      expect(out).to include "Using bundler"
      expect(out).to include "Installing rack 1.0.0"
      expect(rack_lib.open(&:read)).to eq("RACK = '1.0.0'\n")
      expect(the_bundle).to include_gems "rack 1.0.0"
    end

    it "works on first bundle install" do
      bundle "install --force"

      expect(exitstatus).to eq(0) if exitstatus
      expect(out).to include "Using bundler"
      expect(out).to include "Installing rack 1.0.0"
      expect(the_bundle).to include_gems "rack 1.0.0"
    end
  end
end