summaryrefslogtreecommitdiff
path: root/spec/bundler/spec_helper.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-01 23:29:38 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-01 23:29:38 +0000
commitbe7b5929126cb3e696ef222339237faba9b8fe5a (patch)
tree51eae376f93c09bc82dde5a657a91df2c89062e4 /spec/bundler/spec_helper.rb
parentae49dbd392083f69026f2a0fff4a1d5f42d172a7 (diff)
Update bundled bundler to 1.16.0.
* lib/bundler, spec/bundler: Merge bundler-1.16.0. * common.mk: rspec examples of bundler-1.16.0 needs require option. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/bundler/spec_helper.rb')
-rw-r--r--spec/bundler/spec_helper.rb47
1 files changed, 22 insertions, 25 deletions
diff --git a/spec/bundler/spec_helper.rb b/spec/bundler/spec_helper.rb
index 7293f0e57b..cd87a65d54 100644
--- a/spec/bundler/spec_helper.rb
+++ b/spec/bundler/spec_helper.rb
@@ -1,19 +1,21 @@
# frozen_string_literal: true
+
$:.unshift File.expand_path("..", __FILE__)
$:.unshift File.expand_path("../../lib", __FILE__)
+require "rubygems"
require "bundler/psyched_yaml"
-require "fileutils"
+require "bundler/vendored_fileutils"
require "uri"
-require "digest/sha1"
+require "digest"
require File.expand_path("../support/path.rb", __FILE__)
begin
- require "rubygems"
spec = Gem::Specification.load(Spec::Path.gemspec.to_s)
rspec = spec.dependencies.find {|d| d.name == "rspec" }
gem "rspec", rspec.requirement.to_s
require "rspec"
+ require "diff/lcs"
rescue LoadError
abort "Run rake spec:deps to install development dependencies"
end
@@ -36,16 +38,17 @@ else
end
Dir["#{File.expand_path("../support", __FILE__)}/*.rb"].each do |file|
+ file = file.gsub(%r{\A#{Regexp.escape File.expand_path("..", __FILE__)}/}, "")
require file unless file.end_with?("hax.rb")
end
$debug = false
+Spec::Manpages.setup
Spec::Rubygems.setup
FileUtils.rm_rf(Spec::Path.gem_repo1)
ENV["RUBYOPT"] = "#{ENV["RUBYOPT"]} -r#{Spec::Path.spec_dir}/support/hax.rb"
ENV["BUNDLE_SPEC_RUN"] = "true"
-ENV["BUNDLE_PLUGINS"] = "true"
# Don't wrap output in tests
ENV["THOR_COLUMNS"] = "10000"
@@ -78,7 +81,7 @@ RSpec.configure do |config|
# once we have a large number of failures (indicative of core pieces of
# bundler being broken) so that running the full test suite doesn't take
# forever due to memory constraints
- config.fail_fast ||= 25
+ config.fail_fast ||= 25 if ENV["CI"]
if ENV["BUNDLER_SUDO_TESTS"] && Spec::Sudo.present?
config.filter_run :sudo => true
@@ -98,49 +101,41 @@ RSpec.configure do |config|
config.filter_run_excluding :rubygems => LessThanProc.with(Gem::VERSION)
config.filter_run_excluding :git => LessThanProc.with(git_version)
config.filter_run_excluding :rubygems_master => (ENV["RGV"] != "master")
+ config.filter_run_excluding :bundler => LessThanProc.with(Bundler::VERSION.split(".")[0, 2].join("."))
config.filter_run_excluding :ruby_repo => !!(ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"])
config.filter_run_when_matching :focus unless ENV["CI"]
original_wd = Dir.pwd
- original_env = ENV.to_hash
+ original_env = ENV.to_hash.delete_if {|k, _v| k.start_with?(Bundler::EnvironmentPreserver::BUNDLER_PREFIX) }
config.expect_with :rspec do |c|
c.syntax = :expect
end
config.before :suite do
- @orig_ruby = if ENV['BUNDLE_RUBY']
- ruby = Gem.ruby
- Gem.ruby = ENV['BUNDLE_RUBY']
- ruby
- end
+ if ENV['BUNDLE_RUBY']
+ @orig_ruby = Gem.ruby
+ Gem.ruby = ENV['BUNDLE_RUBY']
+ end
end
config.before :all do
build_repo1
- # HACK: necessary until rspec-mocks > 3.5.0 is used
- # see https://github.com/bundler/bundler/pull/5363#issuecomment-278089256
- if RUBY_VERSION < "1.9"
- FileUtils.module_eval do
- alias_method :mkpath, :mkdir_p
- module_function :mkpath
- end
- end
end
config.before :each do
reset!
system_gems []
in_app_root
- @all_output = String.new
+ @command_executions = []
end
config.after :each do |example|
- @all_output.strip!
- if example.exception && !@all_output.empty?
- warn @all_output unless config.formatters.grep(RSpec::Core::Formatters::DocumentationFormatter).empty?
- message = example.exception.message + "\n\nCommands:\n#{@all_output}"
+ all_output = @command_executions.map(&:to_s_verbose).join("\n\n")
+ if example.exception && !all_output.empty?
+ warn all_output unless config.formatters.grep(RSpec::Core::Formatters::DocumentationFormatter).empty?
+ message = example.exception.message + "\n\nCommands:\n#{all_output}"
(class << example.exception; self; end).send(:define_method, :message) do
message
end
@@ -151,6 +146,8 @@ RSpec.configure do |config|
end
config.after :suite do
- Gem.ruby = @orig_ruby
+ if ENV['BUNDLE_RUBY']
+ Gem.ruby = @orig_ruby
+ end
end
end