summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-04-14 13:23:29 +0200
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-04-15 15:09:47 +0200
commit65f63305a295f5ce10710235cbe83359fde65157 (patch)
treebfefebdafe74f0ebddeb431cc457b6e29a001c8e
parentd4598ca9395d5757b5987037ae23827347a9385d (diff)
downloadbundler-65f63305a295f5ce10710235cbe83359fde65157.tar.gz
Add some specs for rubygems paths in `bundle env`
-rw-r--r--spec/bundler/env_spec.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/bundler/env_spec.rb b/spec/bundler/env_spec.rb
index 45294960dd..3d42c6df02 100644
--- a/spec/bundler/env_spec.rb
+++ b/spec/bundler/env_spec.rb
@@ -18,6 +18,47 @@ RSpec.describe Bundler::Env do
expect(out).to include(OpenSSL::OPENSSL_VERSION)
end
+ describe "rubygems paths" do
+ it "prints gem home" do
+ with_clear_paths("GEM_HOME", "/a/b/c") do
+ out = described_class.report
+ expect(out).to include("Gem Home /a/b/c")
+ end
+ end
+
+ it "prints gem path" do
+ with_clear_paths("GEM_PATH", "/a/b/c:/d/e/f") do
+ out = described_class.report
+ expect(out).to include("Gem Path /a/b/c:/d/e/f")
+ end
+ end
+
+ it "prints user path" do
+ with_clear_paths("HOME", "/a/b/c") do
+ out = described_class.report
+ expect(out).to include("User Path /a/b/c/.gem")
+ end
+ end
+
+ it "prints bin dir" do
+ with_clear_paths("GEM_HOME", "/a/b/c") do
+ out = described_class.report
+ expect(out).to include("Bin Dir /a/b/c/bin")
+ end
+ end
+
+ private
+
+ def with_clear_paths(env_var, env_value)
+ old_env_var = ENV[env_var]
+ ENV[env_var] = env_value
+ Gem.clear_paths
+ yield
+ ensure
+ ENV[env_var] = old_env_var
+ end
+ end
+
context "when there is a Gemfile and a lockfile and print_gemfile is true" do
before do
gemfile "gem 'rack', '1.0.0'"