spec/support/helpers.rb in bundler-1.1.pre.10 vs spec/support/helpers.rb in bundler-1.1.rc
- old
+ new
@@ -33,10 +33,24 @@
groups = args.map {|a| a.inspect }.join(", ")
setup = "require 'rubygems' ; require 'bundler' ; Bundler.setup(#{groups})\n"
@out = ruby(setup + cmd, :expect_err => expect_err, :env => env)
end
+ def load_error_run(ruby, gem, *args)
+ cmd = <<-R
+ begin
+ #{ruby}
+ rescue LoadError => e
+ $stderr.puts "ZOMG LOAD ERROR" if e.message.include?("-- #{gem}")
+ end
+ R
+ opts = args.last.is_a?(Hash) ? args.pop : {}
+ opts.merge!(:expect_err => true)
+ args += [opts]
+ run(cmd, *args)
+ end
+
def lib
File.expand_path('../../../lib', __FILE__)
end
def bundle(cmd, options = {})
@@ -69,9 +83,20 @@
expect_err = options.delete(:expect_err)
env = (options.delete(:env) || {}).map{|k,v| "#{k}='#{v}' "}.join
ruby.gsub!(/["`\$]/) {|m| "\\#{m}" }
lib_option = options[:no_lib] ? "" : " -I#{lib}"
sys_exec(%{#{env}#{Gem.ruby}#{lib_option} -e "#{ruby}"}, expect_err)
+ end
+
+ def load_error_ruby(ruby, gem, opts = {})
+ cmd = <<-R
+ begin
+ #{ruby}
+ rescue LoadError => e
+ $stderr.puts "ZOMG LOAD ERROR"# if e.message.include?("-- #{gem}")
+ end
+ R
+ ruby(cmd, opts.merge(:expect_err => true))
end
def gembin(cmd)
lib = File.expand_path("../../../lib", __FILE__)
old, ENV['RUBYOPT'] = ENV['RUBYOPT'], "#{ENV['RUBYOPT']} -I#{lib}"