summaryrefslogtreecommitdiff
path: root/spec/bundler/install
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2019-06-01 12:49:40 +0300
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-06-09 12:44:10 +0900
commit8f37629519ad330032a38ac0e871b2912ed38a1b (patch)
treebb0529b77583d47993d8b0d608d68896aa3a5298 /spec/bundler/install
parent66508992483ae5d77b56a98427c50c772341c0ac (diff)
Merge bundler master from upstream.
Pick from 8dd59e3ba97eb80a599f8149f31bf40773b69dc0
Diffstat (limited to 'spec/bundler/install')
-rw-r--r--spec/bundler/install/bundler_spec.rb7
-rw-r--r--spec/bundler/install/deploy_spec.rb2
-rw-r--r--spec/bundler/install/failure_spec.rb8
-rw-r--r--spec/bundler/install/gemfile/gemspec_spec.rb4
-rw-r--r--spec/bundler/install/gemfile/git_spec.rb18
-rw-r--r--spec/bundler/install/gemfile/path_spec.rb64
-rw-r--r--spec/bundler/install/gemfile/sources_spec.rb51
-rw-r--r--spec/bundler/install/gems/compact_index_spec.rb2
-rw-r--r--spec/bundler/install/gems/flex_spec.rb4
-rw-r--r--spec/bundler/install/gems/resolving_spec.rb6
-rw-r--r--spec/bundler/install/gems/standalone_spec.rb16
-rw-r--r--spec/bundler/install/gems/sudo_spec.rb27
-rw-r--r--spec/bundler/install/gemspecs_spec.rb4
-rw-r--r--spec/bundler/install/path_spec.rb75
-rw-r--r--spec/bundler/install/post_bundle_message_spec.rb206
15 files changed, 142 insertions, 352 deletions
diff --git a/spec/bundler/install/bundler_spec.rb b/spec/bundler/install/bundler_spec.rb
index 3347988cdd..fad6d68010 100644
--- a/spec/bundler/install/bundler_spec.rb
+++ b/spec/bundler/install/bundler_spec.rb
@@ -48,7 +48,7 @@ RSpec.describe "bundle install" do
Could not find gem 'bundler (= 0.9.2)' in any
E
- expect(last_command.bundler_err).to include(nice_error)
+ expect(err).to include(nice_error)
end
it "works for gems with multiple versions in its dependencies" do
@@ -104,7 +104,7 @@ RSpec.describe "bundle install" do
rails_fail was resolved to 1.0, which depends on
activesupport (= 1.2.3)
E
- expect(last_command.bundler_err).to include(nice_error)
+ expect(err).to include(nice_error)
end
it "causes a conflict if a child dependency conflicts with the Gemfile" do
@@ -122,7 +122,7 @@ RSpec.describe "bundle install" do
rails_fail was resolved to 1.0, which depends on
activesupport (= 1.2.3)
E
- expect(last_command.bundler_err).to include(nice_error)
+ expect(err).to include(nice_error)
end
it "can install dependencies with newer bundler version with system gems" do
@@ -140,7 +140,6 @@ RSpec.describe "bundle install" do
it "can install dependencies with newer bundler version with a local path" do
bundle! "config set path .bundle"
- bundle! "config set global_path_appends_ruby_scope true"
install_gemfile! <<-G
source "file://#{gem_repo2}"
gem "rails", "3.0"
diff --git a/spec/bundler/install/deploy_spec.rb b/spec/bundler/install/deploy_spec.rb
index 0a12b6f116..9569b4d54c 100644
--- a/spec/bundler/install/deploy_spec.rb
+++ b/spec/bundler/install/deploy_spec.rb
@@ -366,7 +366,7 @@ RSpec.describe "install with --deployment or --frozen" do
G
expect(the_bundle).not_to include_gems "rack 1.0.0"
- expect(last_command.stderr).to include strip_whitespace(<<-E).strip
+ expect(err).to include strip_whitespace(<<-E).strip
The dependencies in your gemfile changed
You have added to the Gemfile:
diff --git a/spec/bundler/install/failure_spec.rb b/spec/bundler/install/failure_spec.rb
index 49e2771dca..ac3c707187 100644
--- a/spec/bundler/install/failure_spec.rb
+++ b/spec/bundler/install/failure_spec.rb
@@ -18,7 +18,7 @@ RSpec.describe "bundle install" do
source "file:\/\/localhost#{gem_repo2}"
gem "rails"
G
- expect(last_command.bundler_err).to end_with(normalize_uri_file(<<-M.strip))
+ expect(err).to end_with(normalize_uri_file(<<-M.strip))
An error occurred while installing activesupport (2.3.2), and Bundler cannot continue.
Make sure that `gem install activesupport -v '2.3.2' --source 'file://localhost#{gem_repo2}/'` succeeds before bundling.
@@ -46,7 +46,7 @@ In Gemfile:
gem "activesupport", :git => "#{lib_path("activesupport")}"
G
- expect(last_command.bundler_err).to end_with(<<-M.strip)
+ expect(err).to end_with(<<-M.strip)
An error occurred while installing activesupport (2.3.2), and Bundler cannot continue.
In Gemfile:
@@ -77,7 +77,7 @@ In Gemfile:
end
G
- expect(last_command.bundler_err).to end_with(<<-M.strip)
+ expect(err).to end_with(<<-M.strip)
An error occurred while installing activesupport (2.3.2), and Bundler cannot continue.
@@ -111,7 +111,7 @@ In Gemfile:
gem "rails"
end
G
- expect(last_command.bundler_err).to end_with(normalize_uri_file(<<-M.strip))
+ expect(err).to end_with(normalize_uri_file(<<-M.strip))
An error occurred while installing activesupport (2.3.2), and Bundler cannot continue.
Make sure that `gem install activesupport -v '2.3.2' --source 'file://localhost#{gem_repo2}/'` succeeds before bundling.
diff --git a/spec/bundler/install/gemfile/gemspec_spec.rb b/spec/bundler/install/gemfile/gemspec_spec.rb
index 0bec2e9d96..bf1f4d7b9a 100644
--- a/spec/bundler/install/gemfile/gemspec_spec.rb
+++ b/spec/bundler/install/gemfile/gemspec_spec.rb
@@ -65,7 +65,7 @@ RSpec.describe "bundle install from an existing gemspec" do
source "file://#{gem_repo2}"
gemspec :path => '#{tmp.join("foo")}'
G
- expect(last_command.bundler_err).to match(/There are no gemspecs at #{tmp.join('foo')}/)
+ expect(err).to match(/There are no gemspecs at #{tmp.join('foo')}/)
end
it "should raise if there are too many gemspecs available" do
@@ -77,7 +77,7 @@ RSpec.describe "bundle install from an existing gemspec" do
source "file://#{gem_repo2}"
gemspec :path => '#{tmp.join("foo")}'
G
- expect(last_command.bundler_err).to match(/There are multiple gemspecs at #{tmp.join('foo')}/)
+ expect(err).to match(/There are multiple gemspecs at #{tmp.join('foo')}/)
end
it "should pick a specific gemspec" do
diff --git a/spec/bundler/install/gemfile/git_spec.rb b/spec/bundler/install/gemfile/git_spec.rb
index c6738686bb..8ca22f1d87 100644
--- a/spec/bundler/install/gemfile/git_spec.rb
+++ b/spec/bundler/install/gemfile/git_spec.rb
@@ -204,7 +204,7 @@ RSpec.describe "bundle install with git sources" do
gem "foo"
end
G
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
run <<-RUBY
require 'foo'
@@ -234,7 +234,7 @@ RSpec.describe "bundle install with git sources" do
gem "foo"
end
G
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
run! <<-RUBY
require 'foo'
@@ -270,7 +270,7 @@ RSpec.describe "bundle install with git sources" do
gem "foo"
end
G
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
run! <<-RUBY
require 'foo'
@@ -515,7 +515,7 @@ RSpec.describe "bundle install with git sources" do
bundle solution
bundle :install
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
it "explodes and gives correct solution if branch is not given on install" do
@@ -537,7 +537,7 @@ RSpec.describe "bundle install with git sources" do
bundle solution
bundle :install
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
it "does not explode if disable_local_branch_check is given" do
@@ -1197,7 +1197,7 @@ RSpec.describe "bundle install with git sources" do
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
- expect(last_command.bundler_err).to end_with(<<-M.strip)
+ expect(err).to end_with(<<-M.strip)
An error occurred while installing foo (1.0), and Bundler cannot continue.
In Gemfile:
@@ -1380,7 +1380,7 @@ In Gemfile:
with_path_as("") do
bundle "update", :all => true
end
- expect(last_command.bundler_err).
+ expect(err).
to include("You need to install git to be able to use gems from git repositories. For help installing git, please refer to GitHub's tutorial at https://help.github.com/articles/set-up-git")
end
@@ -1437,7 +1437,7 @@ In Gemfile:
G
expect(last_command.stdboth).to_not include("password1")
- expect(last_command.stdout).to include("Fetching https://user1@github.com/company/private-repo")
+ expect(out).to include("Fetching https://user1@github.com/company/private-repo")
end
end
@@ -1452,7 +1452,7 @@ In Gemfile:
G
expect(last_command.stdboth).to_not include("oauth_token")
- expect(last_command.stdout).to include("Fetching https://x-oauth-basic@github.com/company/private-repo")
+ expect(out).to include("Fetching https://x-oauth-basic@github.com/company/private-repo")
end
end
end
diff --git a/spec/bundler/install/gemfile/path_spec.rb b/spec/bundler/install/gemfile/path_spec.rb
index 54a41b576f..e80764070c 100644
--- a/spec/bundler/install/gemfile/path_spec.rb
+++ b/spec/bundler/install/gemfile/path_spec.rb
@@ -313,7 +313,7 @@ RSpec.describe "bundle install with explicit source paths" do
install_gemfile <<-G
gem 'foo', '1.0', :path => "#{lib_path("foo-1.0")}"
G
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
it "removes the .gem file after installing" do
@@ -484,6 +484,68 @@ RSpec.describe "bundle install with explicit source paths" do
expect(the_bundle).to include_gems "rack 1.0.0"
end
+
+ it "keeps using the same version if it's compatible" do
+ build_lib "foo", "1.0", :path => lib_path("foo") do |s|
+ s.add_dependency "rack", "0.9.1"
+ end
+
+ bundle "install"
+
+ expect(the_bundle).to include_gems "rack 0.9.1"
+
+ lockfile_should_be <<-G
+ PATH
+ remote: #{lib_path("foo")}
+ specs:
+ foo (1.0)
+ rack (= 0.9.1)
+
+ GEM
+ remote: #{URI.parse("file://#{gem_repo1}/")}
+ specs:
+ rack (0.9.1)
+
+ PLATFORMS
+ #{lockfile_platforms}
+
+ DEPENDENCIES
+ foo!
+
+ BUNDLED WITH
+ #{Bundler::VERSION}
+ G
+
+ build_lib "foo", "1.0", :path => lib_path("foo") do |s|
+ s.add_dependency "rack"
+ end
+
+ bundle "install"
+
+ lockfile_should_be <<-G
+ PATH
+ remote: #{lib_path("foo")}
+ specs:
+ foo (1.0)
+ rack
+
+ GEM
+ remote: #{URI.parse("file://#{gem_repo1}/")}
+ specs:
+ rack (0.9.1)
+
+ PLATFORMS
+ #{lockfile_platforms}
+
+ DEPENDENCIES
+ foo!
+
+ BUNDLED WITH
+ #{Bundler::VERSION}
+ G
+
+ expect(the_bundle).to include_gems "rack 0.9.1"
+ end
end
describe "switching sources" do
diff --git a/spec/bundler/install/gemfile/sources_spec.rb b/spec/bundler/install/gemfile/sources_spec.rb
index 8e1205dfa3..da364a51bb 100644
--- a/spec/bundler/install/gemfile/sources_spec.rb
+++ b/spec/bundler/install/gemfile/sources_spec.rb
@@ -471,13 +471,13 @@ RSpec.describe "bundle install with gems on multiple sources" do
context "when a single source contains multiple locked gems" do
before do
- # 1. With these gems,
+ # With these gems,
build_repo4 do
build_gem "foo", "0.1"
build_gem "bar", "0.1"
end
- # 2. Installing this gemfile will produce...
+ # Installing this gemfile...
gemfile <<-G
source 'file://#{gem_repo1}'
gem 'rack'
@@ -485,28 +485,9 @@ RSpec.describe "bundle install with gems on multiple sources" do
gem 'bar', '~> 0.1', :source => 'file://#{gem_repo4}'
G
- # 3. this lockfile.
- lockfile <<-L
- GEM
- remote: file:/Users/andre/src/bundler/bundler/tmp/gems/remote1/
- remote: file:/Users/andre/src/bundler/bundler/tmp/gems/remote4/
- specs:
- bar (0.1)
- foo (0.1)
- rack (1.0.0)
-
- PLATFORMS
- ruby
-
- DEPENDENCIES
- bar (~> 0.1)!
- foo (~> 0.1)!
- rack
- L
-
bundle! :install, forgotten_command_line_options(:path => "../gems/system")
- # 4. Then we add some new versions...
+ # And then we add some new versions...
update_repo4 do
build_gem "foo", "0.2"
build_gem "bar", "0.3"
@@ -514,7 +495,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
it "allows them to be unlocked separately" do
- # 5. and install this gemfile, updating only foo.
+ # And install this gemfile, updating only foo.
install_gemfile <<-G
source 'file://#{gem_repo1}'
gem 'rack'
@@ -522,7 +503,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
gem 'bar', '~> 0.1', :source => 'file://#{gem_repo4}'
G
- # 6. Which should update foo to 0.2, but not the (locked) bar 0.1
+ # It should update foo to 0.2, but not the (locked) bar 0.1
expect(the_bundle).to include_gems("foo 0.2", "bar 0.1")
end
end
@@ -578,7 +559,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
# When this gemfile is installed...
- gemfile <<-G
+ install_gemfile <<-G
source "#{source_uri}"
source "#{second_uri}" do
@@ -588,26 +569,6 @@ RSpec.describe "bundle install with gems on multiple sources" do
gem "rack-obama"
G
- # It creates this lockfile.
- lockfile <<-L
- GEM
- remote: #{source_uri}/
- remote: #{second_uri}/
- specs:
- rack (2.0.1.1.forked)
- rack-obama (1.0)
- rack
- thor (0.19.1.1.forked)
-
- PLATFORMS
- ruby
-
- DEPENDENCIES
- rack (= 2.0.1.1.forked)!
- rack-obama
- thor!
- L
-
# Then we change the Gemfile by adding a version to thor
gemfile <<-G
source "#{source_uri}"
diff --git a/spec/bundler/install/gems/compact_index_spec.rb b/spec/bundler/install/gems/compact_index_spec.rb
index b94b68dbd9..e35b630306 100644
--- a/spec/bundler/install/gems/compact_index_spec.rb
+++ b/spec/bundler/install/gems/compact_index_spec.rb
@@ -60,7 +60,7 @@ RSpec.describe "compact index api" do
# can't use `include_gems` here since the `require` will conflict on a
# case-insensitive FS
run! "Bundler.require; puts Gem.loaded_specs.values_at('rack', 'Rack').map(&:full_name)"
- expect(last_command.stdout).to eq("rack-1.0\nRack-0.1")
+ expect(out).to eq("rack-1.0\nRack-0.1")
end
it "should handle multiple gem dependencies on the same gem" do
diff --git a/spec/bundler/install/gems/flex_spec.rb b/spec/bundler/install/gems/flex_spec.rb
index aeb83d6573..d15841124a 100644
--- a/spec/bundler/install/gems/flex_spec.rb
+++ b/spec/bundler/install/gems/flex_spec.rb
@@ -188,7 +188,7 @@ RSpec.describe "bundle flex_install" do
ruby <<-RUBY
require 'bundler/setup'
RUBY
- expect(last_command.stderr).to match(/could not find gem 'rack-obama/i)
+ expect(err).to match(/could not find gem 'rack-obama/i)
end
it "suggests bundle update when the Gemfile requires different versions than the lock" do
@@ -209,7 +209,7 @@ RSpec.describe "bundle flex_install" do
E
bundle :install, :retry => 0
- expect(last_command.bundler_err).to end_with(nice_error)
+ expect(err).to end_with(nice_error)
end
end
diff --git a/spec/bundler/install/gems/resolving_spec.rb b/spec/bundler/install/gems/resolving_spec.rb
index cf3aaa719e..7bab676cea 100644
--- a/spec/bundler/install/gems/resolving_spec.rb
+++ b/spec/bundler/install/gems/resolving_spec.rb
@@ -77,7 +77,7 @@ RSpec.describe "bundle install with install-time dependencies" do
bundle :install, :env => { "DEBUG_RESOLVER" => "1" }
- expect(last_command.stderr).to include("Creating possibility state for net_c")
+ expect(err).to include("Creating possibility state for net_c")
end
end
@@ -91,7 +91,7 @@ RSpec.describe "bundle install with install-time dependencies" do
bundle :install, :env => { "DEBUG_RESOLVER_TREE" => "1" }
- expect(last_command.stderr).to include(" net_b").
+ expect(err).to include(" net_b").
and include("Starting resolution").
and include("Finished resolution").
and include("Attempting to activate")
@@ -171,7 +171,7 @@ RSpec.describe "bundle install with install-time dependencies" do
Ruby\0 (> 9000), which is required by gem 'require_ruby', is not available in the local ruby installation
E
- expect(last_command.bundler_err).to end_with(nice_error)
+ expect(err).to end_with(nice_error)
end
end
diff --git a/spec/bundler/install/gems/standalone_spec.rb b/spec/bundler/install/gems/standalone_spec.rb
index e2cfe5ec4c..68796977a4 100644
--- a/spec/bundler/install/gems/standalone_spec.rb
+++ b/spec/bundler/install/gems/standalone_spec.rb
@@ -175,8 +175,8 @@ RSpec.shared_examples "bundle install --standalone" do
RUBY
end
- expect(last_command.stdout).to eq("2.3.2")
- expect(last_command.stderr).to eq("ZOMG LOAD ERROR")
+ expect(out).to eq("2.3.2")
+ expect(err).to eq("ZOMG LOAD ERROR")
end
it "allows --without to limit the groups used in a standalone" do
@@ -193,8 +193,8 @@ RSpec.shared_examples "bundle install --standalone" do
RUBY
end
- expect(last_command.stdout).to eq("2.3.2")
- expect(last_command.stderr).to eq("ZOMG LOAD ERROR")
+ expect(out).to eq("2.3.2")
+ expect(err).to eq("ZOMG LOAD ERROR")
end
it "allows --path to change the location of the standalone bundle", :bundler => "< 3" do
@@ -210,7 +210,7 @@ RSpec.shared_examples "bundle install --standalone" do
RUBY
end
- expect(last_command.stdout).to eq("2.3.2")
+ expect(out).to eq("2.3.2")
end
it "allows --path to change the location of the standalone bundle", :bundler => "3" do
@@ -227,7 +227,7 @@ RSpec.shared_examples "bundle install --standalone" do
RUBY
end
- expect(last_command.stdout).to eq("2.3.2")
+ expect(out).to eq("2.3.2")
end
it "allows remembered --without to limit the groups used in a standalone" do
@@ -245,8 +245,8 @@ RSpec.shared_examples "bundle install --standalone" do
RUBY
end
- expect(last_command.stdout).to eq("2.3.2")
- expect(last_command.stderr).to eq("ZOMG LOAD ERROR")
+ expect(out).to eq("2.3.2")
+ expect(err).to eq("ZOMG LOAD ERROR")
end
end
diff --git a/spec/bundler/install/gems/sudo_spec.rb b/spec/bundler/install/gems/sudo_spec.rb
index fb41f63a07..0d2d6b7eb4 100644
--- a/spec/bundler/install/gems/sudo_spec.rb
+++ b/spec/bundler/install/gems/sudo_spec.rb
@@ -3,13 +3,20 @@
RSpec.describe "when using sudo", :sudo => true do
describe "and BUNDLE_PATH is writable" do
context "but BUNDLE_PATH/build_info is not writable" do
+ let(:subdir) do
+ system_gem_path("cache")
+ end
+
before do
bundle! "config set path.system true"
- subdir = system_gem_path("cache")
subdir.mkpath
sudo "chmod u-w #{subdir}"
end
+ after do
+ sudo "chmod u+w #{subdir}"
+ end
+
it "installs" do
install_gemfile <<-G
source "file://#{gem_repo1}"
@@ -52,8 +59,6 @@ RSpec.describe "when using sudo", :sudo => true do
end
it "installs when BUNDLE_PATH is owned by root" do
- bundle! "config set global_path_appends_ruby_scope false" # consistency in tests between 1.x and 2.x modes
-
bundle_path = tmp("owned_by_root")
FileUtils.mkdir_p bundle_path
sudo "chown -R root #{bundle_path}"
@@ -64,14 +69,12 @@ RSpec.describe "when using sudo", :sudo => true do
gem "rack", '1.0'
G
- expect(bundle_path.join("gems/rack-1.0.0")).to exist
- expect(bundle_path.join("gems/rack-1.0.0").stat.uid).to eq(0)
+ expect(bundle_path.join(Bundler.ruby_scope, "gems/rack-1.0.0")).to exist
+ expect(bundle_path.join(Bundler.ruby_scope, "gems/rack-1.0.0").stat.uid).to eq(0)
expect(the_bundle).to include_gems "rack 1.0"
end
it "installs when BUNDLE_PATH does not exist" do
- bundle! "config set global_path_appends_ruby_scope false" # consistency in tests between 1.x and 2.x modes
-
root_path = tmp("owned_by_root")
FileUtils.mkdir_p root_path
sudo "chown -R root #{root_path}"
@@ -83,8 +86,8 @@ RSpec.describe "when using sudo", :sudo => true do
gem "rack", '1.0'
G
- expect(bundle_path.join("gems/rack-1.0.0")).to exist
- expect(bundle_path.join("gems/rack-1.0.0").stat.uid).to eq(0)
+ expect(bundle_path.join(Bundler.ruby_scope, "gems/rack-1.0.0")).to exist
+ expect(bundle_path.join(Bundler.ruby_scope, "gems/rack-1.0.0").stat.uid).to eq(0)
expect(the_bundle).to include_gems "rack 1.0"
end
@@ -105,6 +108,10 @@ RSpec.describe "when using sudo", :sudo => true do
sudo "chmod ugo-w #{default_bundle_path}"
end
+ after do
+ sudo "chmod ugo+w #{default_bundle_path}"
+ end
+
it "installs" do
install_gemfile <<-G
source "file://#{gem_repo1}"
@@ -146,6 +153,8 @@ RSpec.describe "when using sudo", :sudo => true do
bundle :install, :env => { "GEM_HOME" => gem_home.to_s, "GEM_PATH" => nil }
expect(gem_home.join("bin/rackup")).to exist
expect(the_bundle).to include_gems "rack 1.0", :env => { "GEM_HOME" => gem_home.to_s, "GEM_PATH" => nil }
+
+ sudo "rm -rf #{tmp("sudo_gem_home")}"
end
end
diff --git a/spec/bundler/install/gemspecs_spec.rb b/spec/bundler/install/gemspecs_spec.rb
index c9878ccae8..55c7a67b4b 100644
--- a/spec/bundler/install/gemspecs_spec.rb
+++ b/spec/bundler/install/gemspecs_spec.rb
@@ -14,7 +14,7 @@ RSpec.describe "bundle install" do
gem "yaml_spec"
G
bundle :install
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
it "still installs correctly when using path" do
@@ -23,7 +23,7 @@ RSpec.describe "bundle install" do
install_gemfile <<-G
gem 'yaml_spec', :path => "#{lib_path("yaml_spec-1.0")}"
G
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
end
diff --git a/spec/bundler/install/path_spec.rb b/spec/bundler/install/path_spec.rb
index 0947ed9539..b2a3375342 100644
--- a/spec/bundler/install/path_spec.rb
+++ b/spec/bundler/install/path_spec.rb
@@ -113,71 +113,36 @@ RSpec.describe "bundle install" do
expect(the_bundle).to include_gems "rack 1.0.0"
end
- context "with global_path_appends_ruby_scope set", :bundler => "3" do
- it "installs gems to ." do
- set_bundle_path(type, ".")
- bundle! "config set --global disable_shared_gems true"
+ it "installs gems to ." do
+ set_bundle_path(type, ".")
+ bundle! "config set --global disable_shared_gems true"
- bundle! :install
-
- paths_to_exist = %w[cache/rack-1.0.0.gem gems/rack-1.0.0 specifications/rack-1.0.0.gemspec].map {|path| bundled_app(Bundler.ruby_scope, path) }
- expect(paths_to_exist).to all exist
- expect(the_bundle).to include_gems "rack 1.0.0"
- end
-
- it "installs gems to the path" do
- set_bundle_path(type, bundled_app("vendor").to_s)
-
- bundle! :install
+ bundle! :install
- expect(bundled_app("vendor", Bundler.ruby_scope, "gems/rack-1.0.0")).to be_directory
- expect(the_bundle).to include_gems "rack 1.0.0"
- end
+ paths_to_exist = %w[cache/rack-1.0.0.gem gems/rack-1.0.0 specifications/rack-1.0.0.gemspec].map {|path| bundled_app(Bundler.ruby_scope, path) }
+ expect(paths_to_exist).to all exist
+ expect(the_bundle).to include_gems "rack 1.0.0"
+ end
- it "installs gems to the path relative to root when relative" do
- set_bundle_path(type, "vendor")
+ it "installs gems to the path" do
+ set_bundle_path(type, bundled_app("vendor").to_s)
- FileUtils.mkdir_p bundled_app("lol")
- Dir.chdir(bundled_app("lol")) do
- bundle! :install
- end
+ bundle! :install
- expect(bundled_app("vendor", Bundler.ruby_scope, "gems/rack-1.0.0")).to be_directory
- expect(the_bundle).to include_gems "rack 1.0.0"
- end
+ expect(bundled_app("vendor", Bundler.ruby_scope, "gems/rack-1.0.0")).to be_directory
+ expect(the_bundle).to include_gems "rack 1.0.0"
end
- context "with global_path_appends_ruby_scope unset", :bundler => "< 3" do
- it "installs gems to ." do
- set_bundle_path(type, ".")
- bundle! "config set --global disable_shared_gems true"
+ it "installs gems to the path relative to root when relative" do
+ set_bundle_path(type, "vendor")
+ FileUtils.mkdir_p bundled_app("lol")
+ Dir.chdir(bundled_app("lol")) do
bundle! :install
-
- expect([bundled_app("cache/rack-1.0.0.gem"), bundled_app("gems/rack-1.0.0"), bundled_app("specifications/rack-1.0.0.gemspec")]).to all exist
- expect(the_bundle).to include_gems "rack 1.0.0"
- end
-
- it "installs gems to BUNDLE_PATH with #{type}" do
- set_bundle_path(type, bundled_app("vendor").to_s)
-
- bundle :install
-
- expect(bundled_app("vendor/gems/rack-1.0.0")).to be_directory
- expect(the_bundle).to include_gems "rack 1.0.0"
end
- it "installs gems to BUNDLE_PATH relative to root when relative" do
- set_bundle_path(type, "vendor")
-
- FileUtils.mkdir_p bundled_app("lol")
- Dir.chdir(bundled_app("lol")) do
- bundle :install
- end
-
- expect(bundled_app("vendor/gems/rack-1.0.0")).to be_directory
- expect(the_bundle).to include_gems "rack 1.0.0"
- end
+ expect(bundled_app("vendor", Bundler.ruby_scope, "gems/rack-1.0.0")).to be_directory
+ expect(the_bundle).to include_gems "rack 1.0.0"
end
end
end
@@ -226,7 +191,7 @@ RSpec.describe "bundle install" do
vendored_gems("extensions").rmtree
run "require 'very_simple_binary_c'"
- expect(last_command.stderr).to include("Bundler::GemNotFound")
+ expect(err).to include("Bundler::GemNotFound")
bundle :install, forgotten_command_line_options(:path => "./vendor/bundle")
diff --git a/spec/bundler/install/post_bundle_message_spec.rb b/spec/bundler/install/post_bundle_message_spec.rb
deleted file mode 100644
index 1efd0b8146..0000000000
--- a/spec/bundler/install/post_bundle_message_spec.rb
+++ /dev/null
@@ -1,206 +0,0 @@
-# frozen_string_literal: true
-
-RSpec.describe "post bundle message" do
- before :each do
- gemfile <<-G
- source "file://#{gem_repo1}"
- gem "rack"
- gem "activesupport", "2.3.5", :group => [:emo, :test]
- group :test do
- gem "rspec"
- end
- gem "rack-obama", :group => :obama
- G
- end
-
- let(:bundle_path) { "./.bundle" }
- let(:bundle_show_system_message) { "Use `bundle info [gemname]` to see where a bundled gem is installed." }
- let(:bundle_show_path_message) { "Bundled gems are installed into `#{bundle_path}`" }
- 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 < 3 ? bundle_show_system_message : bundle_show_path_message }
-
- describe "for fresh bundle install" do
- it "without any options" do
- bundle :install
- expect(out).to include(bundle_show_message)
- expect(out).not_to include("Gems in the group")
- expect(out).to include(bundle_complete_message)
- expect(out).to include(installed_gems_stats)
- end
-
- it "with --without one group" do
- bundle! :install, forgotten_command_line_options(:without => "emo")
- expect(out).to include(bundle_show_message)
- expect(out).to include("Gems in the group emo were not installed")
- expect(out).to include(bundle_complete_message)
- expect(out).to include(installed_gems_stats)
- end
-
- it "with --without two groups" do
- bundle! :install, forgotten_command_line_options(:without => "emo test")
- expect(out).to include(bundle_show_message)
- expect(out).to include("Gems in the groups emo and test were not installed")
- expect(out).to include(bundle_complete_message)
- expect(out).to include("4 Gemfile dependencies, 3 gems now installed.")
- end
-
- it "with --without more groups" do
- bundle! :install, forgotten_command_line_options(:without => "emo obama test")
- expect(out).to include(bundle_show_message)
- expect(out).to include("Gems in the groups emo, obama and test were not installed")
- expect(out).to include(bundle_complete_message)
- expect(out).to include("4 Gemfile dependencies, 2 gems now installed.")
- end
-
- describe "with --path and" do
- let(:bundle_path) { "./vendor" }
-
- it "without any options" do
- bundle! :install, forgotten_command_line_options(:path => "vendor")
- expect(out).to include(bundle_show_path_message)
- expect(out).to_not include("Gems in the group")
- expect(out).to include(bundle_complete_message)
- end
-
- it "with --without one group" do
- bundle! :install, forgotten_command_line_options(:without => "emo", :path => "vendor")
- expect(out).to include(bundle_show_path_message)
- expect(out).to include("Gems in the group emo were not installed")
- expect(out).to include(bundle_complete_message)
- end
-
- it "with --without two groups" do
- bundle! :install, forgotten_command_line_options(:without => "emo test", :path => "vendor")
- expect(out).to include(bundle_show_path_message)
- expect(out).to include("Gems in the groups emo and test were not installed")
- expect(out).to include(bundle_complete_message)
- end
-
- it "with --without more groups" do
- bundle! :install, forgotten_command_line_options(:without => "emo obama test", :path => "vendor")
- expect(out).to include(bundle_show_path_message)
- expect(out).to include("Gems in the groups emo, obama and test were not installed")
- expect(out).to include(bundle_complete_message)
- end
-
- it "with an absolute --path inside the cwd" do
- bundle! :install, forgotten_command_line_options(:path => bundled_app("cache"))
- expect(out).to include("Bundled gems are installed into `./cache`")
- expect(out).to_not include("Gems in the group")
- expect(out).to include(bundle_complete_message)
- end
-
- it "with an absolute --path outside the cwd" do
- bundle! :install, forgotten_command_line_options(:path => tmp("not_bundled_app"))
- expect(out).to include("Bundled gems are installed into `#{tmp("not_bundled_app")}`")
- expect(out).to_not include("Gems in the group")
- expect(out).to include(bundle_complete_message)
- end
- end
-
- describe "with misspelled or non-existent gem name" do
- it "should report a helpful error message", :bundler => "< 3" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "rack"
- gem "not-a-gem", :group => :development
- G
- expect(err).to include("Could not find gem 'not-a-gem' in any of the gem sources listed in your Gemfile.")
- end
-
- it "should report a helpful error message", :bundler => "3" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "rack"
- gem "not-a-gem", :group => :development
- G
- expect(err).to include normalize_uri_file(<<-EOS.strip)
-Could not find gem 'not-a-gem' in rubygems repository file://localhost#{gem_repo1}/ or installed locally.
-The source does not contain any versions of 'not-a-gem'
- EOS
- end
-
- it "should report a helpful error message with reference to cache if available" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "rack"
- G
- bundle :cache
- expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "rack"
- gem "not-a-gem", :group => :development
- G
- expect(err).to include("Could not find gem 'not-a-gem' in").
- and include("or in gems cached in vendor/cache.")
- end
- end
- end
-
- describe "for second bundle install run" do
- it "without any options" do
- 2.times { bundle :install }
- expect(out).to include(bundle_show_message)
- expect(out).to_not include("Gems in the groups")
- expect(out).to include(bundle_complete_message)
- expect(out).to include(installed_gems_stats)
- end
-
- it "with --without one group" do
- bundle! :install, forgotten_command_line_options(:without => "emo")
- bundle! :install
- expect(out).to include(bundle_show_message)
- expect(out).to include("Gems in the group emo were not installed")
- expect(out).to include(bundle_complete_message)
- expect(out).to include(installed_gems_stats)
- end
-
- it "with --without two groups" do
- bundle! :install, forgotten_command_line_options(:without => "emo test")
- bundle! :install
- expect(out).to include(bundle_show_message)
- expect(out).to include("Gems in the groups emo and test were not installed")
- expect(out).to include(bundle_complete_message)
- end
-
- it "with --without more groups" do
- bundle! :install, forgotten_command_line_options(:without => "emo obama test")
- bundle :install
- expect(out).to include(bundle_show_message)
- expect(out).to include("Gems in the groups emo, obama and test were not installed")
- expect(out).to include(bundle_complete_message)
- end
- end
-
- describe "for bundle update" do
- it "without any options" do
- bundle! :update, :all => true
- expect(out).not_to include("Gems in the groups")
- expect(out).to include(bundle_updated_message)
- end
-
- it "with --without one group" do
- bundle! :install, forgotten_command_line_options(:without => "emo")
- bundle! :update, :all => true
- expect(out).to include("Gems in the group emo were not installed")
- expect(out).to include(bundle_updated_message)
- end
-
- it "with --without two groups" do
- bundle! :install, forgotten_command_line_options(:without => "emo test")
- bundle! :update, :all => true
- expect(out).to include("Gems in the groups emo and test were not installed")
- expect(out).to include(bundle_updated_message)
- end
-
- it "with --without more groups" do
- bundle! :install, forgotten_command_line_options(:without => "emo obama test")
- bundle! :update, :all => true
- expect(out).to include("Gems in the groups emo, obama and test were not installed")
- expect(out).to include(bundle_updated_message)
- end
- end
-end