diff options
-rw-r--r-- | spec/bundler/env_spec.rb | 41 |
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'" |