summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColby Swandale <me@colby.fyi>2018-11-05 09:43:08 +1100
committerColby Swandale <me@colby.fyi>2018-11-08 21:55:49 +1100
commit36687280a7f0d8455ffbffb0339452291b5bc10e (patch)
tree657b00288038b8c5c92a48dc47ccc85f02599f77
parented413c68c653827e7430ce3eac2140fd7d95edc1 (diff)
downloadbundler-36687280a7f0d8455ffbffb0339452291b5bc10e.tar.gz
fix breaking specs
-rw-r--r--spec/commands/binstubs_spec.rb27
-rw-r--r--spec/commands/clean_spec.rb2
-rw-r--r--spec/commands/exec_spec.rb41
-rw-r--r--spec/commands/init_spec.rb2
-rw-r--r--spec/commands/pristine_spec.rb2
-rw-r--r--spec/commands/show_spec.rb8
-rw-r--r--spec/install/deploy_spec.rb2
-rw-r--r--spec/install/post_bundle_message_spec.rb2
-rw-r--r--spec/install/redownload_spec.rb4
-rw-r--r--spec/other/major_deprecation_spec.rb10
-rw-r--r--spec/other/platform_spec.rb2
-rw-r--r--spec/quality_spec.rb1
-rw-r--r--spec/realworld/edgecases_spec.rb4
-rw-r--r--spec/support/helpers.rb2
-rw-r--r--spec/update/redownload_spec.rb8
15 files changed, 55 insertions, 62 deletions
diff --git a/spec/commands/binstubs_spec.rb b/spec/commands/binstubs_spec.rb
index 9334216a6c..82b40c887a 100644
--- a/spec/commands/binstubs_spec.rb
+++ b/spec/commands/binstubs_spec.rb
@@ -134,6 +134,33 @@ RSpec.describe "bundle binstubs <gem>" do
if ENV["BUNDLER_SPEC_SUB_VERSION"]
let(:system_bundler_version) { Bundler::VERSION }
end
+
+ before do
+ gemfile <<-G
+ source "file:///Users/colby/Projects/bundler/tmp/gems/remote2"
+ gem "rack"
+ gem "prints_loaded_gems"
+ G
+
+ lockfile <<-G
+ GEM
+ remote: file:///Users/colby/Projects/bundler/tmp/gems/remote2/
+ specs:
+ prints_loaded_gems (1.0)
+ rack (1.2)
+
+ PLATFORMS
+ ruby
+
+ DEPENDENCIES
+ prints_loaded_gems
+ rack
+
+ BUNDLED WITH
+ #{system_bundler_version}
+ G
+ end
+
it "runs bundler" do
sys_exec! "#{bundled_app("bin/bundle")} install"
expect(out).to eq %(system bundler #{system_bundler_version}\n["install"])
diff --git a/spec/commands/clean_spec.rb b/spec/commands/clean_spec.rb
index f53480f421..99789f0257 100644
--- a/spec/commands/clean_spec.rb
+++ b/spec/commands/clean_spec.rb
@@ -142,7 +142,7 @@ RSpec.describe "bundle clean" do
bundle :clean
digest = Digest(:SHA1).hexdigest(git_path.to_s)
- cache_path = Bundler::VERSION.start_with?("1.") ? vendored_gems("cache/bundler/git/foo-1.0-#{digest}") : home(".bundle/cache/git/foo-1.0-#{digest}")
+ cache_path = Bundler.bundler_major_version < 3 ? vendored_gems("cache/bundler/git/foo-1.0-#{digest}") : home(".bundle/cache/git/foo-1.0-#{digest}")
expect(cache_path).to exist
end
diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb
index 5ef02e0528..904b54d52d 100644
--- a/spec/commands/exec_spec.rb
+++ b/spec/commands/exec_spec.rb
@@ -570,22 +570,7 @@ RSpec.describe "bundle exec" do
it_behaves_like "it runs"
end
- context "the executable is empty", :bundler => "< 3" do
- let(:executable) { "" }
-
- let(:exit_code) { 0 }
- let(:expected) { "#{path} is empty" }
- let(:expected_err) { "" }
- if LessThanProc.with(RUBY_VERSION).call("1.9")
- # Kernel#exec in ruby < 1.9 will raise Errno::ENOEXEC if the command content is empty,
- # even if the command is set as an executable.
- pending "Kernel#exec is different"
- else
- it_behaves_like "it runs"
- end
- end
-
- context "the executable is empty", :bundler => "3" do
+ context "the executable is empty" do
let(:executable) { "" }
let(:exit_code) { 0 }
@@ -594,18 +579,7 @@ RSpec.describe "bundle exec" do
it_behaves_like "it runs"
end
- context "the executable raises", :bundler => "< 3" do
- let(:executable) { super() << "\nraise 'ERROR'" }
- let(:exit_code) { 1 }
- let(:expected) { super() << "\nbundler: failed to load command: #{path} (#{path})" }
- let(:expected_err) do
- "RuntimeError: ERROR\n #{path}:10" +
- (Bundler.current_ruby.ruby_18? ? "" : ":in `<top (required)>'")
- end
- it_behaves_like "it runs"
- end
-
- context "the executable raises", :bundler => "3" do
+ context "the executable raises" do
let(:executable) { super() << "\nraise 'ERROR'" }
let(:exit_code) { 1 }
let(:expected_err) do
@@ -615,16 +589,7 @@ RSpec.describe "bundle exec" do
it_behaves_like "it runs"
end
- context "the executable raises an error without a backtrace", :bundler => "< 3" do
- let(:executable) { super() << "\nclass Err < Exception\ndef backtrace; end;\nend\nraise Err" }
- let(:exit_code) { 1 }
- let(:expected) { super() << "\nbundler: failed to load command: #{path} (#{path})" }
- let(:expected_err) { "Err: Err" }
-
- it_behaves_like "it runs"
- end
-
- context "the executable raises an error without a backtrace", :bundler => "3" do
+ context "the executable raises an error without a backtrace" do
let(:executable) { super() << "\nclass Err < Exception\ndef backtrace; end;\nend\nraise Err" }
let(:exit_code) { 1 }
let(:expected_err) { "bundler: failed to load command: #{path} (#{path})\nErr: Err" }
diff --git a/spec/commands/init_spec.rb b/spec/commands/init_spec.rb
index e0782f28f7..8a8f0effa0 100644
--- a/spec/commands/init_spec.rb
+++ b/spec/commands/init_spec.rb
@@ -115,7 +115,7 @@ RSpec.describe "bundle init" do
bundle :init, :gemspec => spec_file
- gemfile = if Bundler::VERSION[0, 2] == "1."
+ gemfile = if Bundler::VERSION[0, 2].to_i < 3
bundled_app("Gemfile").read
else
bundled_app("gems.rb").read
diff --git a/spec/commands/pristine_spec.rb b/spec/commands/pristine_spec.rb
index a780cbfb5b..20adb13a2c 100644
--- a/spec/commands/pristine_spec.rb
+++ b/spec/commands/pristine_spec.rb
@@ -49,7 +49,7 @@ RSpec.describe "bundle pristine" do
bundle! "pristine", :system_bundler => true
bundle! "-v", :system_bundler => true
- expected = if Bundler::VERSION < "2.0"
+ expected = if Bundler::VERSION < "3.0"
"Bundler version"
else
Bundler::VERSION
diff --git a/spec/commands/show_spec.rb b/spec/commands/show_spec.rb
index bf96ec489a..a5c6beec1a 100644
--- a/spec/commands/show_spec.rb
+++ b/spec/commands/show_spec.rb
@@ -36,7 +36,7 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do
it "prints path if gem exists in bundle" do
bundle "show rails"
expect(out).to eq(
- "[DEPRECATED FOR 2.0] use `bundle info rails` instead of `bundle show rails`\n" +
+ "[DEPRECATED FOR 3.0] use `bundle info rails` instead of `bundle show rails`\n" +
default_bundle_path("gems", "rails-2.3.2").to_s
)
end
@@ -44,7 +44,7 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do
it "prints the path to the running bundler" do
bundle "show bundler"
expect(out).to eq(
- "[DEPRECATED FOR 2.0] use `bundle info bundler` instead of `bundle show bundler`\n" +
+ "[DEPRECATED FOR 3.0] use `bundle info bundler` instead of `bundle show bundler`\n" +
root.to_s
)
end
@@ -52,7 +52,7 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do
it "prints path if gem exists in bundle (with --paths option)" do
bundle "show rails --paths"
expect(out).to eq(
- "[DEPRECATED FOR 2.0] use `bundle info rails --path` instead of `bundle show rails --paths`\n" +
+ "[DEPRECATED FOR 3.0] use `bundle info rails --path` instead of `bundle show rails --paths`\n" +
default_bundle_path("gems", "rails-2.3.2").to_s
)
end
@@ -64,7 +64,7 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do
expect(out).to include(default_bundle_path("gems", "rails-2.3.2").to_s)
out_lines = out.split("\n")
- expect(out_lines[0]).to eq("[DEPRECATED FOR 2.0] use `bundle list` instead of `bundle show --paths`")
+ expect(out_lines[0]).to eq("[DEPRECATED FOR 3.0] use `bundle list` instead of `bundle show --paths`")
# Gem names are the last component of their path.
gem_list = out_lines[1..-1].map {|p| p.split("/").last }
diff --git a/spec/install/deploy_spec.rb b/spec/install/deploy_spec.rb
index 26a062cf79..f3c47d7aa9 100644
--- a/spec/install/deploy_spec.rb
+++ b/spec/install/deploy_spec.rb
@@ -297,7 +297,7 @@ RSpec.describe "install with --deployment or --frozen" do
context "when replacing a host with the same host with credentials" do
let(:success_message) do
- if Bundler::VERSION.split(".", 2).first == "1"
+ if Bundler.bundler_major_version < 3
"Could not reach host localgemserver.test"
else
"Bundle complete!"
diff --git a/spec/install/post_bundle_message_spec.rb b/spec/install/post_bundle_message_spec.rb
index c41dc67458..394134f523 100644
--- a/spec/install/post_bundle_message_spec.rb
+++ b/spec/install/post_bundle_message_spec.rb
@@ -19,7 +19,7 @@ RSpec.describe "post bundle message" do
let(:bundle_complete_message) { "Bundle complete!" }
let(:bundle_updated_message) { "Bundle updated!" }
let(:installed_gems_stats) { "4 Gemfile dependencies, 5 gems now installed." }
- let(:bundle_show_message) { Bundler::VERSION.split(".").first.to_i < 2 ? bundle_show_system_message : bundle_show_path_message }
+ let(:bundle_show_message) { Bundler::VERSION.split(".").first.to_i < 3 ? bundle_show_system_message : bundle_show_path_message }
describe "for fresh bundle install" do
it "without any options" do
diff --git a/spec/install/redownload_spec.rb b/spec/install/redownload_spec.rb
index 25d49999fc..f9caeed58a 100644
--- a/spec/install/redownload_spec.rb
+++ b/spec/install/redownload_spec.rb
@@ -65,12 +65,12 @@ RSpec.describe "bundle install", :bundler => "< 3", :ruby => ">= 2.0" do
it "shows a deprecation when single flag passed" do
bundle! "install --force"
- expect(out).to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
+ expect(out).to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`"
end
it "shows a deprecation when multiple flags passed" do
bundle! "install --no-color --force"
- expect(out).to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
+ expect(out).to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`"
end
end
diff --git a/spec/other/major_deprecation_spec.rb b/spec/other/major_deprecation_spec.rb
index a147d053e1..32827dbd54 100644
--- a/spec/other/major_deprecation_spec.rb
+++ b/spec/other/major_deprecation_spec.rb
@@ -205,7 +205,7 @@ The :github git source is deprecated, and will be removed in Bundler 2.0. Change
git_source(:github) {|repo_name| "https://github.com/\#{repo_name}.git" }
EOS
- expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, msg)
+ expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg)
subject.gem("sparks", :github => "indirect/sparks")
end
@@ -217,8 +217,8 @@ The :github git source is deprecated, and will be removed in Bundler 2.0. Change
git_source(:github) {|repo_name| "https://github.com/\#{repo_name}.git" }
EOS
- expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, msg)
- expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, "The `github.https` setting will be removed")
+ expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg)
+ expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, "The `github.https` setting will be removed")
subject.gem("sparks", :github => "indirect/sparks")
github_uri = "https://github.com/indirect/sparks.git"
expect(subject.dependencies.first.source.uri).to eq(github_uri)
@@ -238,7 +238,7 @@ The :bitbucket git source is deprecated, and will be removed in Bundler 2.0. Add
end
EOS
- expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, msg)
+ expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg)
subject.gem("not-really-a-gem", :bitbucket => "mcorp/flatlab-rails")
end
end
@@ -250,7 +250,7 @@ The :bitbucket git source is deprecated, and will be removed in Bundler 2.0. Add
"in Bundler 2.0. Add this code to the top of your Gemfile to ensure it " \
"continues to work:\n\n git_source(:gist) {|repo_name| " \
"\"https://gist.github.com/\#{repo_name}.git\" }\n\n"
- expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, msg)
+ expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg)
subject.gem("not-really-a-gem", :gist => "1234")
end
end
diff --git a/spec/other/platform_spec.rb b/spec/other/platform_spec.rb
index 96527e1641..6c59fd893c 100644
--- a/spec/other/platform_spec.rb
+++ b/spec/other/platform_spec.rb
@@ -4,7 +4,7 @@ RSpec.describe "bundle platform" do
context "without flags" do
let(:bundle_platform_platforms_string) do
platforms = [rb]
- platforms.unshift(specific_local_platform) if Bundler.feature_flag.bundler_2_mode?
+ platforms.unshift(specific_local_platform) if Bundler.feature_flag.bundler_3_mode?
platforms.map {|pl| "* #{pl}" }.join("\n")
end
diff --git a/spec/quality_spec.rb b/spec/quality_spec.rb
index 5ebe0baff4..317c799573 100644
--- a/spec/quality_spec.rb
+++ b/spec/quality_spec.rb
@@ -177,6 +177,7 @@ RSpec.describe "The library itself" do
gem.coc
gem.mit
inline
+ lockfile_upgrade_warning
lockfile_uses_separate_rubygems_sources
use_gem_version_promoter_for_major_updates
viz_command
diff --git a/spec/realworld/edgecases_spec.rb b/spec/realworld/edgecases_spec.rb
index aa60e20b8a..bbfd0f68fd 100644
--- a/spec/realworld/edgecases_spec.rb
+++ b/spec/realworld/edgecases_spec.rb
@@ -57,7 +57,7 @@ RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do
expect(lockfile).to include("activemodel (3.0.5)")
end
- it "resolves dependencies correctly", :ruby => "1.9.3" do
+ it "resolves dependencies correctly", :ruby => "<= 1.9.3" do
gemfile <<-G
source "https://rubygems.org"
@@ -70,7 +70,7 @@ RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do
expect(lockfile).to include("capybara (2.2.1)")
end
- it "installs the latest version of gxapi_rails", :ruby => "1.9.3" do
+ it "installs the latest version of gxapi_rails", :ruby => "<= 1.9.3" do
gemfile <<-G
source "https://rubygems.org"
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index dbe5c665e5..4bc3cef0cf 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -150,7 +150,7 @@ module Spec
bang :bundle
def forgotten_command_line_options(options)
- remembered = Bundler::VERSION.split(".", 2).first == "1"
+ remembered = Bundler.bundler_major_version < 3
options = options.map do |k, v|
k = Array(k)[remembered ? 0 : -1]
v = '""' if v && v.to_s.empty?
diff --git a/spec/update/redownload_spec.rb b/spec/update/redownload_spec.rb
index 2138af510c..1bbc3a66fc 100644
--- a/spec/update/redownload_spec.rb
+++ b/spec/update/redownload_spec.rb
@@ -13,24 +13,24 @@ RSpec.describe "bundle update", :bundler => "< 3", :ruby => ">= 2.0" do
describe "with --force" do
it "shows a deprecation when single flag passed" do
bundle! "update rack --force"
- expect(out).to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
+ expect(out).to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`"
end
it "shows a deprecation when multiple flags passed" do
bundle! "update rack --no-color --force"
- expect(out).to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
+ expect(out).to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`"
end
end
describe "with --redownload" do
it "does not show a deprecation when single flag passed" do
bundle! "update rack --redownload"
- expect(out).not_to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
+ expect(out).not_to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`"
end
it "does not show a deprecation when single multiple flags passed" do
bundle! "update rack --no-color --redownload"
- expect(out).not_to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
+ expect(out).not_to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`"
end
end
end