diff options
Diffstat (limited to 'spec/bundler/bundler/env_spec.rb')
-rw-r--r-- | spec/bundler/bundler/env_spec.rb | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/spec/bundler/bundler/env_spec.rb b/spec/bundler/bundler/env_spec.rb index 20bd38b021..8323a9a7b3 100644 --- a/spec/bundler/bundler/env_spec.rb +++ b/spec/bundler/bundler/env_spec.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require "openssl" require "bundler/settings" RSpec.describe Bundler::Env do @@ -17,6 +18,54 @@ 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 home" do + with_clear_paths("HOME", "/a/b/c") do + out = described_class.report + expect(out).to include("User Home /a/b/c") + 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'" |