diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-04-14 06:01:35 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-04-14 06:01:35 +0000 |
commit | 68ddd4d300e9a88737c4f37af74e1a0312949b2f (patch) | |
tree | 787e1e83d76934ce039eb336995a8d5bb53a89e6 /spec/bundler/install/deploy_spec.rb | |
parent | d636809c057432e8d42abe30c6c6785eb0721d77 (diff) |
Merge Bundler 2.1.0.pre.1 as developed version from upstream.
https://github.com/bundler/bundler/commit/a53709556b95a914e874b22ed2116a46b0528852
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/bundler/install/deploy_spec.rb')
-rw-r--r-- | spec/bundler/install/deploy_spec.rb | 126 |
1 files changed, 55 insertions, 71 deletions
diff --git a/spec/bundler/install/deploy_spec.rb b/spec/bundler/install/deploy_spec.rb index ec72ff69fc..918dbabfbe 100644 --- a/spec/bundler/install/deploy_spec.rb +++ b/spec/bundler/install/deploy_spec.rb @@ -11,26 +11,26 @@ RSpec.describe "install with --deployment or --frozen" do context "with CLI flags", :bundler => "< 3" do it "fails without a lockfile and says that --deployment requires a lock" do bundle "install --deployment" - expect(out).to include("The --deployment flag requires a Gemfile.lock") + expect(err).to include("The --deployment flag requires a Gemfile.lock") end it "fails without a lockfile and says that --frozen requires a lock" do bundle "install --frozen" - expect(out).to include("The --frozen flag requires a Gemfile.lock") + expect(err).to include("The --frozen flag requires a Gemfile.lock") end it "disallows --deployment --system" do bundle "install --deployment --system" - expect(out).to include("You have specified both --deployment") - expect(out).to include("Please choose only one option") + expect(err).to include("You have specified both --deployment") + expect(err).to include("Please choose only one option") expect(exitstatus).to eq(15) if exitstatus end it "disallows --deployment --path --system" do bundle "install --deployment --path . --system" - expect(out).to include("You have specified both --path") - expect(out).to include("as well as --system") - expect(out).to include("Please choose only one option") + expect(err).to include("You have specified both --path") + expect(err).to include("as well as --system") + expect(err).to include("Please choose only one option") expect(exitstatus).to eq(15) if exitstatus end @@ -129,11 +129,11 @@ RSpec.describe "install with --deployment or --frozen" do G bundle :install, forgotten_command_line_options(:deployment => true) - expect(out).to include("deployment mode") - expect(out).to include("You have added to the Gemfile") - expect(out).to include("* rack-obama") - expect(out).not_to include("You have deleted from the Gemfile") - expect(out).not_to include("You have changed in the Gemfile") + expect(err).to include("deployment mode") + expect(err).to include("You have added to the Gemfile") + expect(err).to include("* rack-obama") + expect(err).not_to include("You have deleted from the Gemfile") + expect(err).not_to include("You have changed in the Gemfile") end it "works if a path gem is missing but is in a without group" do @@ -162,7 +162,7 @@ RSpec.describe "install with --deployment or --frozen" do FileUtils.rm_r lib_path("path_gem-1.0") bundle :install, forgotten_command_line_options(:path => ".bundle", :deployment => true) - expect(out).to include("The path `#{lib_path("path_gem-1.0")}` does not exist.") + expect(err).to include("The path `#{lib_path("path_gem-1.0")}` does not exist.") end it "can have --frozen set via an environment variable", :bundler => "< 3" do @@ -174,11 +174,11 @@ RSpec.describe "install with --deployment or --frozen" do ENV["BUNDLE_FROZEN"] = "1" bundle "install" - expect(out).to include("deployment mode") - expect(out).to include("You have added to the Gemfile") - expect(out).to include("* rack-obama") - expect(out).not_to include("You have deleted from the Gemfile") - expect(out).not_to include("You have changed in the Gemfile") + expect(err).to include("deployment mode") + expect(err).to include("You have added to the Gemfile") + expect(err).to include("* rack-obama") + expect(err).not_to include("You have deleted from the Gemfile") + expect(err).not_to include("You have changed in the Gemfile") end it "can have --deployment set via an environment variable" do @@ -190,11 +190,11 @@ RSpec.describe "install with --deployment or --frozen" do ENV["BUNDLE_DEPLOYMENT"] = "true" bundle "install" - expect(out).to include("deployment mode") - expect(out).to include("You have added to the Gemfile") - expect(out).to include("* rack-obama") - expect(out).not_to include("You have deleted from the Gemfile") - expect(out).not_to include("You have changed in the Gemfile") + expect(err).to include("deployment mode") + expect(err).to include("You have added to the Gemfile") + expect(err).to include("* rack-obama") + expect(err).not_to include("You have deleted from the Gemfile") + expect(err).not_to include("You have changed in the Gemfile") end it "can have --frozen set to false via an environment variable" do @@ -212,21 +212,6 @@ RSpec.describe "install with --deployment or --frozen" do expect(out).not_to include("* rack-obama") end - it "explodes with the --frozen flag if you make a change and don't check in the lockfile", :bundler => "< 2" do - gemfile <<-G - source "file://#{gem_repo1}" - gem "rack" - gem "rack-obama", "1.1" - G - - bundle :install, forgotten_command_line_options(:frozen => true) - expect(out).to include("deployment mode") - expect(out).to include("You have added to the Gemfile") - expect(out).to include("* rack-obama (= 1.1)") - expect(out).not_to include("You have deleted from the Gemfile") - expect(out).not_to include("You have changed in the Gemfile") - end - it "explodes if you remove a gem and don't check in the lockfile" do gemfile <<-G source "file://#{gem_repo1}" @@ -234,10 +219,10 @@ RSpec.describe "install with --deployment or --frozen" do G bundle :install, forgotten_command_line_options(:deployment => true) - expect(out).to include("deployment mode") - expect(out).to include("You have added to the Gemfile:\n* activesupport\n\n") - expect(out).to include("You have deleted from the Gemfile:\n* rack") - expect(out).not_to include("You have changed in the Gemfile") + expect(err).to include("deployment mode") + expect(err).to include("You have added to the Gemfile:\n* activesupport\n\n") + expect(err).to include("You have deleted from the Gemfile:\n* rack") + expect(err).not_to include("You have changed in the Gemfile") end it "explodes if you add a source" do @@ -247,9 +232,9 @@ RSpec.describe "install with --deployment or --frozen" do G bundle :install, forgotten_command_line_options(:deployment => true) - expect(out).to include("deployment mode") - expect(out).to include("You have added to the Gemfile:\n* source: git://hubz.com (at master)") - expect(out).not_to include("You have changed in the Gemfile") + expect(err).to include("deployment mode") + expect(err).to include("You have added to the Gemfile:\n* source: git://hubz.com (at master)") + expect(err).not_to include("You have changed in the Gemfile") end it "explodes if you unpin a source" do @@ -266,10 +251,10 @@ RSpec.describe "install with --deployment or --frozen" do G bundle :install, forgotten_command_line_options(:deployment => true) - expect(out).to include("deployment mode") - expect(out).to include("You have deleted from the Gemfile:\n* source: #{lib_path("rack-1.0")} (at master@#{revision_for(lib_path("rack-1.0"))[0..6]}") - expect(out).not_to include("You have added to the Gemfile") - expect(out).not_to include("You have changed in the Gemfile") + expect(err).to include("deployment mode") + expect(err).to include("You have deleted from the Gemfile:\n* source: #{lib_path("rack-1.0")} (at master@#{revision_for(lib_path("rack-1.0"))[0..6]}") + expect(err).not_to include("You have added to the Gemfile") + expect(err).not_to include("You have changed in the Gemfile") end it "explodes if you unpin a source, leaving it pinned somewhere else" do @@ -289,19 +274,15 @@ RSpec.describe "install with --deployment or --frozen" do G bundle :install, forgotten_command_line_options(:deployment => true) - expect(out).to include("deployment mode") - expect(out).to include("You have changed in the Gemfile:\n* rack from `no specified source` to `#{lib_path("rack")} (at master@#{revision_for(lib_path("rack"))[0..6]})`") - expect(out).not_to include("You have added to the Gemfile") - expect(out).not_to include("You have deleted from the Gemfile") + expect(err).to include("deployment mode") + expect(err).to include("You have changed in the Gemfile:\n* rack from `no specified source` to `#{lib_path("rack")} (at master@#{revision_for(lib_path("rack"))[0..6]})`") + expect(err).not_to include("You have added to the Gemfile") + 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 - if Bundler.bundler_major_version < 3 - "Could not reach host localgemserver.test" - else - "Bundle complete!" - end + "Bundle complete!" end before do @@ -322,31 +303,33 @@ RSpec.describe "install with --deployment or --frozen" do DEPENDENCIES rack G + + bundle! "config set --local deployment true" end it "prevents the replace by default" do - bundle :install, forgotten_command_line_options(:deployment => true) + bundle :install - expect(out).to match(/The list of sources changed/) + expect(err).to match(/The list of sources changed/) end context "when allow_deployment_source_credential_changes is true" do - before { bundle! "config allow_deployment_source_credential_changes true" } + before { bundle! "config set allow_deployment_source_credential_changes true" } it "allows the replace" do - bundle :install, forgotten_command_line_options(:deployment => true) + bundle :install expect(out).to match(/#{success_message}/) end end context "when allow_deployment_source_credential_changes is false" do - before { bundle! "config allow_deployment_source_credential_changes false" } + before { bundle! "config set allow_deployment_source_credential_changes false" } it "prevents the replace" do - bundle :install, forgotten_command_line_options(:deployment => true) + bundle :install - expect(out).to match(/The list of sources changed/) + expect(err).to match(/The list of sources changed/) end end @@ -354,7 +337,7 @@ RSpec.describe "install with --deployment or --frozen" do before { ENV["BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES"] = "true" } it "allows the replace" do - bundle :install, forgotten_command_line_options(:deployment => true) + bundle :install expect(out).to match(/#{success_message}/) end @@ -364,9 +347,9 @@ RSpec.describe "install with --deployment or --frozen" do before { ENV["BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES"] = "false" } it "prevents the replace" do - bundle :install, forgotten_command_line_options(:deployment => true) + bundle :install - expect(out).to match(/The list of sources changed/) + expect(err).to match(/The list of sources changed/) end end end @@ -374,7 +357,7 @@ RSpec.describe "install with --deployment or --frozen" do it "remembers that the bundle is frozen at runtime" do bundle! :lock - bundle! "config deployment true" + bundle! "config set --local deployment true" gemfile <<-G source "file://#{gem_repo1}" @@ -383,7 +366,7 @@ RSpec.describe "install with --deployment or --frozen" do G expect(the_bundle).not_to include_gems "rack 1.0.0" - expect(err).to include strip_whitespace(<<-E).strip + expect(last_command.stderr).to include strip_whitespace(<<-E).strip The dependencies in your gemfile changed You have added to the Gemfile: @@ -412,7 +395,8 @@ You have deleted from the Gemfile: expect(out).to include("Updating files in vendor/cache") simulate_new_machine - bundle! "install --verbose", forgotten_command_line_options(:deployment => true) + bundle! "config set --local deployment true" + bundle! "install --verbose" expect(out).not_to include("You are trying to install in deployment mode after changing your Gemfile") expect(out).not_to include("You have added to the Gemfile") expect(out).not_to include("You have deleted from the Gemfile") |