summaryrefslogtreecommitdiff
path: root/spec/install/deploy_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/install/deploy_spec.rb')
-rw-r--r--spec/install/deploy_spec.rb178
1 files changed, 99 insertions, 79 deletions
diff --git a/spec/install/deploy_spec.rb b/spec/install/deploy_spec.rb
index 89da3fc801..f92a531bf5 100644
--- a/spec/install/deploy_spec.rb
+++ b/spec/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