diff options
author | Brian Hawley <bhawley@verticalresponse.com> | 2016-05-24 19:20:48 -0700 |
---|---|---|
committer | Brian Hawley <bhawley@verticalresponse.com> | 2016-05-24 19:20:48 -0700 |
commit | 1dc9911e5fb999b60ea15f515b9b8001ac005f4f (patch) | |
tree | c7521d0a964ea3c9fb6ca40abe4591e03f257ab8 /spec/runtime | |
parent | dbad52b5b477936b25c2c5605247a9e70a0796cb (diff) | |
download | bundler-1dc9911e5fb999b60ea15f515b9b8001ac005f4f.tar.gz |
Fix the combination of gem :require and env or install_if
If you guard the installation of a gem with env or install_if, and that
gem declaration has a :require option specified, it tried to require
the gem even though it hadn't been installed. It looks like a spot was
missed when the env command was added in the first place.
Diffstat (limited to 'spec/runtime')
-rw-r--r-- | spec/runtime/require_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/runtime/require_spec.rb b/spec/runtime/require_spec.rb index fbfa3982..5ddf1ef0 100644 --- a/spec/runtime/require_spec.rb +++ b/spec/runtime/require_spec.rb @@ -38,6 +38,14 @@ describe "Bundler.require" do s.write "lib/eight.rb", "puts 'eight'" end + build_lib "nine", "1.0.0" do |s| + s.write "lib/nine.rb", "puts 'nine'" + end + + build_lib "ten", "1.0.0" do |s| + s.write "lib/ten.rb", "puts 'ten'" + end + gemfile <<-G path "#{lib_path}" gem "one", :group => :bar, :require => %w[baz qux] @@ -48,6 +56,10 @@ describe "Bundler.require" do gem "six", :group => "string" gem "seven", :group => :not gem "eight", :require => true, :group => :require_true + env "BUNDLER_TEST" => "nine" do + gem "nine", :require => true + end + gem "ten", :install_if => lambda { ENV["BUNDLER_TEST"] == "ten" } G end @@ -86,6 +98,18 @@ describe "Bundler.require" do expect(out).to eq("two\nfive") end + it "allows requiring gems which are scoped by env" do + ENV["BUNDLER_TEST"] = "nine" + run "Bundler.require" + expect(out).to eq("two\nnine") + end + + it "allows requiring gems which are scoped by install_if" do + ENV["BUNDLER_TEST"] = "ten" + run "Bundler.require" + expect(out).to eq("two\nten") + end + it "raises an exception if a require is specified but the file does not exist" do gemfile <<-G path "#{lib_path}" |