diff options
author | Hsing-Hui Hsu <hsing-hui@carezone.com> | 2016-02-03 10:07:41 -0800 |
---|---|---|
committer | Hsing-Hui Hsu <hsing-hui@carezone.com> | 2016-02-06 20:17:18 -0800 |
commit | ee689f171060ee35f0ea863ef03f19a3a5b2c545 (patch) | |
tree | fc0cf92c9b038ba55e2cfe0aad279f8e2cdc5d12 /spec/runtime | |
parent | c47d453219bf6488446b05f9ba7386fc6e9c249f (diff) | |
download | bundler-ee689f171060ee35f0ea863ef03f19a3a5b2c545.tar.gz |
Address feedback on spec.
- Use real -I and RUBYLIB variable setting
- Use Array#index to find path for loaded gem
Diffstat (limited to 'spec/runtime')
-rw-r--r-- | spec/runtime/setup_spec.rb | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb index 453e9603..65a310e7 100644 --- a/spec/runtime/setup_spec.rb +++ b/spec/runtime/setup_spec.rb @@ -108,29 +108,36 @@ describe "Bundler.setup" do end end - it "puts loaded gems after -I and RUBYLIB" do - install_gemfile <<-G - source "file://#{gem_repo1}" - gem "rack" - G + context "load order" do + after do + ENV.delete "RUBYLIB" + ENV.delete "RUBYOPT" + end - ruby <<-RUBY - require 'rubygems' - require 'bundler' - $LOAD_PATH.unshift('fake -I') - Bundler.setup + it "puts loaded gems after -I and RUBYLIB" do + install_gemfile <<-G + source "file://#{gem_repo1}" + gem "rack" + G - puts $LOAD_PATH - RUBY + ENV["RUBYOPT"] = "-I dash_i_dir" + ENV["RUBYLIB"] = "rubylib_dir" - load_path = out.split("\n") - rack_load_order = load_path.each_with_index do |dir, i| - break i if dir =~ /rack/ - end + ruby <<-RUBY + require 'rubygems' + require 'bundler' + Bundler.setup + puts $LOAD_PATH + RUBY + + load_path = out.split("\n") + rack_load_order = load_path.index {|path| path.include?("rack") } - expect(err).to eq("") - expect(load_path.first).to eq("fake -I") - expect(rack_load_order).to be > 0 + expect(err).to eq("") + expect(load_path[1]).to include "dash_i_dir" + expect(load_path[2]).to include "rubylib_dir" + expect(rack_load_order).to be > 0 + end end it "raises if the Gemfile was not yet installed" do |