diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2016-09-07 14:22:01 +0200 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-09-07 14:22:08 +0200 |
commit | 8246923150acae1d163bf2367ce1075db0610b90 (patch) | |
tree | 919529930779dfbbfd6ae09769a37c5b0ce531ab | |
parent | 02e7f67727b45f59ec0aec4df410e05921d94928 (diff) | |
download | bundler-8246923150acae1d163bf2367ce1075db0610b90.tar.gz |
Stop stubbing File.expand_path in SharedHelper specs
-rw-r--r-- | lib/bundler/shared_helpers.rb | 7 | ||||
-rw-r--r-- | spec/bundler/shared_helpers_spec.rb | 5 |
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index 6e95793c03..0ddcea1ca5 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -204,10 +204,15 @@ module Bundler def set_rubylib rubylib = (ENV["RUBYLIB"] || "").split(File::PATH_SEPARATOR) - rubylib.unshift File.expand_path("../..", __FILE__) + rubylib.unshift bundler_ruby_lib ENV["RUBYLIB"] = rubylib.uniq.join(File::PATH_SEPARATOR) end + def bundler_ruby_lib + File.expand_path("../..", __FILE__) + end + private :bundler_ruby_lib + def clean_load_path # handle 1.9 where system gems are always on the load path if defined?(::Gem) diff --git a/spec/bundler/shared_helpers_spec.rb b/spec/bundler/shared_helpers_spec.rb index 4c0d61cf0a..8826dcd4dd 100644 --- a/spec/bundler/shared_helpers_spec.rb +++ b/spec/bundler/shared_helpers_spec.rb @@ -234,7 +234,9 @@ describe Bundler::SharedHelpers do shared_examples_for "ENV['RUBYLIB'] gets set correctly" do let(:ruby_lib_path) { "stubbed_ruby_lib_dir" } - before { allow(File).to receive(:expand_path).and_return(ruby_lib_path) } + before do + allow(Bundler::SharedHelpers).to receive(:bundler_ruby_lib).and_return(ruby_lib_path) + end it "ensures bundler's ruby version lib path is in ENV['RUBYLIB']" do subject.set_bundle_environment @@ -324,7 +326,6 @@ describe Bundler::SharedHelpers do let(:ruby_lib_path) { "stubbed_ruby_lib_dir" } before do - allow(File).to receive(:expand_path).and_return(ruby_lib_path) ENV["RUBYLIB"] = ruby_lib_path end |