summaryrefslogtreecommitdiff
path: root/spec/bundler/commands
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-12 00:53:15 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-12 00:53:15 +0000
commit8f4aa4fd2a609a3eca2f415a12964e86cab94abc (patch)
treeb2717ee3f20a2403393694dc23532fc8e628e19f /spec/bundler/commands
parentab5a3db48e446a33f790fa5e8594a6dc24062987 (diff)
Merge Bundler-2.0.0.pre1 from upstream.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/bundler/commands')
-rw-r--r--spec/bundler/commands/binstubs_spec.rb27
-rw-r--r--spec/bundler/commands/clean_spec.rb2
-rw-r--r--spec/bundler/commands/exec_spec.rb41
-rw-r--r--spec/bundler/commands/init_spec.rb2
-rw-r--r--spec/bundler/commands/pristine_spec.rb2
-rw-r--r--spec/bundler/commands/show_spec.rb8
6 files changed, 37 insertions, 45 deletions
diff --git a/spec/bundler/commands/binstubs_spec.rb b/spec/bundler/commands/binstubs_spec.rb
index 849c5a4f75..7f2e81c099 100644
--- a/spec/bundler/commands/binstubs_spec.rb
+++ b/spec/bundler/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/bundler/commands/clean_spec.rb b/spec/bundler/commands/clean_spec.rb
index da860e62f8..158d58d67c 100644
--- a/spec/bundler/commands/clean_spec.rb
+++ b/spec/bundler/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/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb
index a08f2b6fe8..76841dcff6 100644
--- a/spec/bundler/commands/exec_spec.rb
+++ b/spec/bundler/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/bundler/commands/init_spec.rb b/spec/bundler/commands/init_spec.rb
index e0782f28f7..8a8f0effa0 100644
--- a/spec/bundler/commands/init_spec.rb
+++ b/spec/bundler/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/bundler/commands/pristine_spec.rb b/spec/bundler/commands/pristine_spec.rb
index 0bfc37560a..d8761bba26 100644
--- a/spec/bundler/commands/pristine_spec.rb
+++ b/spec/bundler/commands/pristine_spec.rb
@@ -49,7 +49,7 @@ RSpec.describe "bundle pristine", :ruby_repo 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/bundler/commands/show_spec.rb b/spec/bundler/commands/show_spec.rb
index bf96ec489a..a5c6beec1a 100644
--- a/spec/bundler/commands/show_spec.rb
+++ b/spec/bundler/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 }