diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2019-06-01 12:49:40 +0300 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2019-06-09 12:44:10 +0900 |
commit | 8f37629519ad330032a38ac0e871b2912ed38a1b (patch) | |
tree | bb0529b77583d47993d8b0d608d68896aa3a5298 /spec/bundler/bundler/env_spec.rb | |
parent | 66508992483ae5d77b56a98427c50c772341c0ac (diff) |
Merge bundler master from upstream.
Pick from 8dd59e3ba97eb80a599f8149f31bf40773b69dc0
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'" |