2018-11-02 19:07:56 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-04-14 02:01:35 -04:00
|
|
|
RSpec.describe "bundle install" do
|
2018-11-02 19:07:56 -04:00
|
|
|
before :each do
|
|
|
|
gemfile <<-G
|
2019-05-06 12:06:21 -04:00
|
|
|
source "#{file_uri_for(gem_repo1)}"
|
2018-11-02 19:07:56 -04:00
|
|
|
gem "rack"
|
|
|
|
G
|
|
|
|
end
|
|
|
|
|
|
|
|
shared_examples_for "an option to force redownloading gems" do
|
|
|
|
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, flag => true
|
|
|
|
|
|
|
|
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, flag => true
|
|
|
|
|
|
|
|
expect(out).to include "Installing rack 1.0.0"
|
|
|
|
expect(the_bundle).to include_gems "rack 1.0.0"
|
|
|
|
end
|
|
|
|
|
|
|
|
context "with a git gem" do
|
|
|
|
let!(:ref) { build_git("foo", "1.0").ref_for("HEAD", 11) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
gemfile <<-G
|
|
|
|
gem "foo", :git => "#{lib_path("foo-1.0")}"
|
|
|
|
G
|
|
|
|
end
|
|
|
|
|
|
|
|
it "re-installs installed gems" do
|
|
|
|
foo_lib = default_bundle_path("bundler/gems/foo-1.0-#{ref}/lib/foo.rb")
|
|
|
|
|
|
|
|
bundle! :install
|
|
|
|
foo_lib.open("w") {|f| f.write("blah blah blah") }
|
|
|
|
bundle! :install, flag => true
|
|
|
|
|
|
|
|
expect(foo_lib.open(&:read)).to eq("FOO = '1.0'\n")
|
|
|
|
expect(the_bundle).to include_gems "foo 1.0"
|
|
|
|
end
|
|
|
|
|
|
|
|
it "works on first bundle install" do
|
|
|
|
bundle! :install, flag => true
|
|
|
|
|
|
|
|
expect(the_bundle).to include_gems "foo 1.0"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-04-14 02:01:35 -04:00
|
|
|
describe "with --force", :bundler => 2 do
|
2018-11-02 19:07:56 -04:00
|
|
|
it_behaves_like "an option to force redownloading gems" do
|
|
|
|
let(:flag) { "force" }
|
|
|
|
end
|
|
|
|
|
|
|
|
it "shows a deprecation when single flag passed" do
|
|
|
|
bundle! "install --force"
|
2019-04-14 02:01:35 -04:00
|
|
|
expect(err).to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`"
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it "shows a deprecation when multiple flags passed" do
|
|
|
|
bundle! "install --no-color --force"
|
2019-04-14 02:01:35 -04:00
|
|
|
expect(err).to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`"
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "with --redownload" do
|
|
|
|
it_behaves_like "an option to force redownloading gems" do
|
|
|
|
let(:flag) { "redownload" }
|
|
|
|
end
|
|
|
|
|
|
|
|
it "does not show a deprecation when single flag passed" do
|
|
|
|
bundle! "install --redownload"
|
2019-04-14 02:01:35 -04:00
|
|
|
expect(err).not_to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`"
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it "does not show a deprecation when single multiple flags passed" do
|
|
|
|
bundle! "install --no-color --redownload"
|
2019-04-14 02:01:35 -04:00
|
|
|
expect(err).not_to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`"
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|