summaryrefslogtreecommitdiff
path: root/spec/bundler/install
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2020-01-08 16:11:52 +0900
committerSHIBATA Hiroshi <hsbt@ruby-lang.org>2020-01-08 18:00:32 +0900
commit13f4f07f215ca66cc727c75e0c3d77389c261e14 (patch)
treeebc5d3ad100f4e48773757460ddee256f0035fcb /spec/bundler/install
parentf518b608d64d08024139e8259f5c7b77e630bfff (diff)
Merge bundler-2.1.4
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2822
Diffstat (limited to 'spec/bundler/install')
-rw-r--r--spec/bundler/install/deploy_spec.rb178
-rw-r--r--spec/bundler/install/gemfile/gemspec_spec.rb2
2 files changed, 100 insertions, 80 deletions
diff --git a/spec/bundler/install/deploy_spec.rb b/spec/bundler/install/deploy_spec.rb
index 89da3fc801..f92a531bf5 100644
--- a/spec/bundler/install/deploy_spec.rb
+++ b/spec/bundler/install/deploy_spec.rb
@@ -34,7 +34,7 @@ RSpec.describe "install with --deployment or --frozen" do
expect(exitstatus).to eq(15) if exitstatus
end
- it "works after you try to deploy without a lock" do
+ it "doesn't mess up a subsequent `bundle install` after you try to deploy without a lock" do
bundle "install --deployment"
bundle! :install
expect(the_bundle).to include_gems "rack 1.0"
@@ -42,7 +42,7 @@ RSpec.describe "install with --deployment or --frozen" do
end
it "still works if you are not in the app directory and specify --gemfile" do
- bundle "install"
+ bundle! "install"
Dir.chdir tmp do
simulate_new_machine
bundle! :install,
@@ -60,12 +60,12 @@ RSpec.describe "install with --deployment or --frozen" do
gem "foo", :git => "#{lib_path("foo-1.0")}"
end
G
- bundle :install
+ bundle! :install
bundle! :install, forgotten_command_line_options(:deployment => true, :without => "test")
end
it "works when you bundle exec bundle" do
- bundle :install
+ bundle! :install
bundle "install --deployment"
bundle! "exec bundle check"
end
@@ -104,9 +104,90 @@ RSpec.describe "install with --deployment or --frozen" do
expect(the_bundle).to include_gems "rack 1.0"
end
+ context "when replacing a host with the same host with credentials" do
+ before do
+ bundle! "install", forgotten_command_line_options(:path => "vendor/bundle")
+ gemfile <<-G
+ source "http://user_name:password@localgemserver.test/"
+ gem "rack"
+ G
+
+ lockfile <<-G
+ GEM
+ remote: http://localgemserver.test/
+ specs:
+ rack (1.0.0)
+
+ PLATFORMS
+ #{local}
+
+ DEPENDENCIES
+ rack
+ G
+
+ bundle! "config set --local deployment true"
+ end
+
+ it "prevents the replace by default" do
+ bundle :install
+
+ expect(err).to match(/The list of sources changed/)
+ end
+
+ context "when allow_deployment_source_credential_changes is true" do
+ before { bundle! "config set allow_deployment_source_credential_changes true" }
+
+ it "allows the replace" do
+ bundle! :install
+
+ expect(out).to match(/Bundle complete!/)
+ end
+ end
+
+ context "when allow_deployment_source_credential_changes is false" do
+ before { bundle! "config set allow_deployment_source_credential_changes false" }
+
+ it "prevents the replace" do
+ bundle :install
+
+ expect(err).to match(/The list of sources changed/)
+ end
+ end
+
+ context "when BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES env var is true" do
+ before { ENV["BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES"] = "true" }
+
+ it "allows the replace" do
+ bundle :install
+
+ expect(out).to match(/Bundle complete!/)
+ end
+ end
+
+ context "when BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES env var is false" do
+ before { ENV["BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES"] = "false" }
+
+ it "prevents the replace" do
+ bundle :install
+
+ expect(err).to match(/The list of sources changed/)
+ end
+ end
+ end
+
describe "with an existing lockfile" do
before do
- bundle "install"
+ bundle! "install"
+ end
+
+ it "installs gems by default to vendor/bundle", :bundler => "< 3" do
+ bundle! "install --deployment"
+ expect(out).to include("vendor/bundle")
+ end
+
+ it "installs gems to custom path if specified", :bundler => "< 3" do
+ bundle! "install --path vendor/bundle2 --deployment"
+ expect(out).to include("vendor/bundle2")
end
it "works with the --deployment flag if you didn't change anything", :bundler => "< 3" do
@@ -197,6 +278,19 @@ RSpec.describe "install with --deployment or --frozen" do
expect(err).not_to include("You have changed in the Gemfile")
end
+ it "installs gems by default to vendor/bundle when `--deployment` is set via an environment variable", :bundler => "< 3" do
+ ENV["BUNDLE_DEPLOYMENT"] = "true"
+ bundle "install"
+ expect(out).to include("vendor/bundle")
+ end
+
+ it "installs gems to custom path when deployment mode is set via an environment variable ", :bundler => "< 3" do
+ ENV["BUNDLE_DEPLOYMENT"] = "true"
+ ENV["BUNDLE_PATH"] = "vendor/bundle2"
+ bundle "install"
+ expect(out).to include("vendor/bundle2")
+ end
+
it "can have --frozen set to false via an environment variable" do
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
@@ -280,80 +374,6 @@ RSpec.describe "install with --deployment or --frozen" do
expect(err).not_to include("You have deleted from the Gemfile")
end
- context "when replacing a host with the same host with credentials" do
- let(:success_message) do
- "Bundle complete!"
- end
-
- before do
- install_gemfile <<-G
- source "http://user_name:password@localgemserver.test/"
- gem "rack"
- G
-
- lockfile <<-G
- GEM
- remote: http://localgemserver.test/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{local}
-
- DEPENDENCIES
- rack
- G
-
- bundle! "config set --local deployment true"
- end
-
- it "prevents the replace by default" do
- bundle :install
-
- expect(err).to match(/The list of sources changed/)
- end
-
- context "when allow_deployment_source_credential_changes is true" do
- before { bundle! "config set allow_deployment_source_credential_changes true" }
-
- it "allows the replace" do
- bundle :install
-
- expect(out).to match(/#{success_message}/)
- end
- end
-
- context "when allow_deployment_source_credential_changes is false" do
- before { bundle! "config set allow_deployment_source_credential_changes false" }
-
- it "prevents the replace" do
- bundle :install
-
- expect(err).to match(/The list of sources changed/)
- end
- end
-
- context "when BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES env var is true" do
- before { ENV["BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES"] = "true" }
-
- it "allows the replace" do
- bundle :install
-
- expect(out).to match(/#{success_message}/)
- end
- end
-
- context "when BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES env var is false" do
- before { ENV["BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES"] = "false" }
-
- it "prevents the replace" do
- bundle :install
-
- expect(err).to match(/The list of sources changed/)
- end
- end
- end
-
it "remembers that the bundle is frozen at runtime" do
bundle! :lock
diff --git a/spec/bundler/install/gemfile/gemspec_spec.rb b/spec/bundler/install/gemfile/gemspec_spec.rb
index c50f8c9668..26a6235166 100644
--- a/spec/bundler/install/gemfile/gemspec_spec.rb
+++ b/spec/bundler/install/gemfile/gemspec_spec.rb
@@ -210,7 +210,7 @@ RSpec.describe "bundle install from an existing gemspec" do
build_lib("foo", :path => bundled_app)
gemspec = bundled_app("foo.gemspec").read
bundled_app("foo.gemspec").open("w") do |f|
- f.write "#{gemspec.strip}.tap { gem 'rack-obama'; require 'rack-obama' }"
+ f.write "#{gemspec.strip}.tap { gem 'rack-obama'; require 'rack/obama' }"
end
install_gemfile! <<-G