summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/commands/update_spec.rb35
-rw-r--r--spec/bundler/install/gemfile/git_spec.rb2
-rw-r--r--spec/bundler/lock/git_spec.rb2
-rw-r--r--spec/bundler/support/helpers.rb2
-rw-r--r--spec/bundler/support/path.rb3
5 files changed, 35 insertions, 9 deletions
diff --git a/spec/bundler/commands/update_spec.rb b/spec/bundler/commands/update_spec.rb
index 7016c3e19f..7a0d435860 100644
--- a/spec/bundler/commands/update_spec.rb
+++ b/spec/bundler/commands/update_spec.rb
@@ -659,21 +659,21 @@ RSpec.describe "bundle update" do
expect(last_command).to be_failure
expect(err).to match(/You are trying to install in deployment mode after changing.your Gemfile/m)
- expect(err).to match(/freeze \nby running `bundle config unset deployment`./m)
+ expect(err).to match(/freeze \nby running `bundle config set frozen false`./m)
end
- it "should suggest different command when frozen is set globally", :bundler => "< 3" do
+ it "should fail loudly when frozen is set globally" do
bundle "config set --global frozen 1"
bundle "update", :all => true, :raise_on_error => false
expect(err).to match(/You are trying to install in deployment mode after changing.your Gemfile/m).
- and match(/freeze \nby running `bundle config unset frozen`./m)
+ and match(/freeze \nby running `bundle config set frozen false`./m)
end
- it "should suggest different command when frozen is set globally", :bundler => "3" do
+ it "should fail loudly when deployment is set globally" do
bundle "config set --global deployment true"
bundle "update", :all => true, :raise_on_error => false
expect(err).to match(/You are trying to install in deployment mode after changing.your Gemfile/m).
- and match(/freeze \nby running `bundle config unset deployment`./m)
+ and match(/freeze \nby running `bundle config set frozen false`./m)
end
it "should not suggest any command to unfreeze bundler if frozen is set through ENV" do
@@ -1451,6 +1451,31 @@ RSpec.describe "bundle update --bundler" do
expect(out).to include("Using bundler 2.3.9")
end
end
+
+ it "prints an error when trying to update bundler in frozen mode" do
+ system_gems "bundler-2.3.9"
+
+ gemfile <<~G
+ source "#{file_uri_for(gem_repo2)}"
+ G
+
+ lockfile <<-L
+ GEM
+ remote: #{file_uri_for(gem_repo2)}/
+ specs:
+
+ PLATFORMS
+ ruby
+
+ DEPENDENCIES
+
+ BUNDLED WITH
+ 2.1.4
+ L
+
+ bundle "update --bundler=2.3.9", :env => { "BUNDLE_FROZEN" => "true" }
+ expect(err).to include("Cannot write a changed lockfile while frozen")
+ end
end
# these specs are slow and focus on integration and therefore are not exhaustive. unit specs elsewhere handle that.
diff --git a/spec/bundler/install/gemfile/git_spec.rb b/spec/bundler/install/gemfile/git_spec.rb
index e3be680d89..c96a78bc1c 100644
--- a/spec/bundler/install/gemfile/git_spec.rb
+++ b/spec/bundler/install/gemfile/git_spec.rb
@@ -1148,7 +1148,7 @@ RSpec.describe "bundle install with git sources" do
it "gives a helpful error message when the remote branch no longer exists" do
build_git "foo"
- install_gemfile <<-G, :raise_on_error => false
+ install_gemfile <<-G, :env => { "LANG" => "en" }, :raise_on_error => false
source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{file_uri_for(lib_path("foo-1.0"))}", :branch => "deadbeef"
G
diff --git a/spec/bundler/lock/git_spec.rb b/spec/bundler/lock/git_spec.rb
index 1c1f6fa93d..ac3d10223c 100644
--- a/spec/bundler/lock/git_spec.rb
+++ b/spec/bundler/lock/git_spec.rb
@@ -28,7 +28,7 @@ RSpec.describe "bundle lock with git gems" do
gem 'foo', :git => "#{lib_path("foo-1.0")}", :branch => "bad"
G
- bundle "lock --update foo", :raise_on_error => false
+ bundle "lock --update foo", :env => { "LANG" => "en" }, :raise_on_error => false
expect(err).to include("Revision bad does not exist in the repository")
end
diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb
index 9bfa1458c6..7b8c56b6ad 100644
--- a/spec/bundler/support/helpers.rb
+++ b/spec/bundler/support/helpers.rb
@@ -302,7 +302,7 @@ module Spec
def install_gem(path, default = false)
raise "OMG `#{path}` does not exist!" unless File.exist?(path)
- args = "--no-document --ignore-dependencies"
+ args = "--no-document --ignore-dependencies --verbose --local"
args += " --default --install-dir #{system_gem_path}" if default
gem_command "install #{args} '#{path}'"
diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb
index 2870a8b678..5c156c47cf 100644
--- a/spec/bundler/support/path.rb
+++ b/spec/bundler/support/path.rb
@@ -42,7 +42,8 @@ module Spec
end
def dev_gemfile
- @dev_gemfile ||= tool_dir.join("dev_gems.rb")
+ name = RUBY_VERSION.start_with?("2.6") ? "dev26_gems.rb" : "dev_gems.rb"
+ @dev_gemfile ||= tool_dir.join(name)
end
def bindir