summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2017-07-08 09:34:35 +0000
committerThe Bundler Bot <bot@bundler.io>2017-07-08 09:34:35 +0000
commit17a117b8876911d4799113d736855a4d58914b47 (patch)
tree2ea860f6a741ce0643f7df5c2132b60719b2418f
parent1075e4454c771782c7a00dda676d17bcca66d401 (diff)
parent296404e87f9acec09aa94f548ce4b0022270d310 (diff)
downloadbundler-17a117b8876911d4799113d736855a4d58914b47.tar.gz
Auto merge of #5837 - bundler:seg-default-gem-activation-spec-hack, r=segiddins
Improve logging in default gem activation specs ### What was the end-user problem that led to this PR? The problem was those specs were failing on CI and I couldn't figure out why. ### What was your diagnosis of the problem? My diagnosis was we needed the hack loaded before all bundler code. ### What is your fix for the problem, implemented in this PR? My fix gets the hack loaded in via an `-r` switch set in `RUBYOPT` ### Why did you choose this fix out of the possible options? I chose this fix because it will make spec failures more informative.
-rw-r--r--spec/runtime/setup_spec.rb24
1 files changed, 14 insertions, 10 deletions
diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb
index 3025b502ae..5e8d652497 100644
--- a/spec/runtime/setup_spec.rb
+++ b/spec/runtime/setup_spec.rb
@@ -1235,7 +1235,7 @@ end
end << "bundler"
end
- let(:code) { strip_whitespace(<<-RUBY) }
+ let(:activation_warning_hack) { strip_whitespace(<<-RUBY) }
require "rubygems"
if Gem::Specification.instance_methods.map(&:to_sym).include?(:activate)
@@ -1250,7 +1250,14 @@ end
bundler_spec_activate
end
end
+ RUBY
+
+ let(:activation_warning_hack_rubyopt) do
+ create_file("activation_warning_hack.rb", activation_warning_hack)
+ "-r#{bundled_app("activation_warning_hack.rb")} #{ENV["RUBYOPT"]}"
+ end
+ let(:code) { strip_whitespace(<<-RUBY) }
require "bundler/setup"
require "pp"
loaded_specs = Gem.loaded_specs.dup
@@ -1266,17 +1273,15 @@ end
it "activates no gems with -rbundler/setup" do
install_gemfile! ""
- ruby!(code)
- expect(err).to eq("")
- expect(out).to eq("{}")
+ ruby! code, :env => { :RUBYOPT => activation_warning_hack_rubyopt }
+ expect(last_command.stdout).to eq("{}")
end
it "activates no gems with bundle exec" do
install_gemfile! ""
create_file("script.rb", code)
- bundle! "exec ruby ./script.rb"
- expect(err).to eq("")
- expect(out).to eq("{}")
+ bundle! "exec ruby ./script.rb", :env => { :RUBYOPT => activation_warning_hack_rubyopt }
+ expect(last_command.stdout).to eq("{}")
end
it "activates no gems with bundle exec that is loaded" do
@@ -1286,9 +1291,8 @@ end
install_gemfile! ""
create_file("script.rb", "#!/usr/bin/env ruby\n\n#{code}")
FileUtils.chmod(0o777, bundled_app("script.rb"))
- bundle! "exec ./script.rb", :artifice => nil
- expect(err).to eq("")
- expect(out).to eq("{}")
+ bundle! "exec ./script.rb", :artifice => nil, :env => { :RUBYOPT => activation_warning_hack_rubyopt }
+ expect(last_command.stdout).to eq("{}")
end
let(:default_gems) do