summaryrefslogtreecommitdiff
path: root/spec/bundler/install/gems
diff options
context:
space:
mode:
Diffstat (limited to 'spec/bundler/install/gems')
-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
5 files changed, 32 insertions, 23 deletions
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