summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2017-10-30 19:47:58 -0500
committerSamuel Giddins <segiddins@segiddins.me>2017-10-30 19:49:37 -0500
commita0b8d0f822091038872679083cfb9d1addde6b7f (patch)
treea9d15b749b4ab3aa1a471cf0a1c5ca547ab8c091
parent1b8facd3410381fc1f6ab7a52e50bf1826a66199 (diff)
downloadbundler-a0b8d0f822091038872679083cfb9d1addde6b7f.tar.gz
Properly handle unsafe YAML warnings in specs on Ruby 1.8.7
-rw-r--r--lib/bundler/deprecate.rb7
-rw-r--r--spec/quality_spec.rb3
-rw-r--r--spec/spec_helper.rb2
3 files changed, 11 insertions, 1 deletions
diff --git a/lib/bundler/deprecate.rb b/lib/bundler/deprecate.rb
index 927f827268..387f632a39 100644
--- a/lib/bundler/deprecate.rb
+++ b/lib/bundler/deprecate.rb
@@ -1,5 +1,12 @@
# frozen_string_literal: true
+begin
+ require "rubygems/deprecate"
+rescue LoadError
+ # it's fine if it doesn't exist on the current RubyGems...
+ nil
+end
+
module Bundler
if defined? Bundler::Deprecate
# nothing to do!
diff --git a/spec/quality_spec.rb b/spec/quality_spec.rb
index d4f3ddaf9b..067e9c4901 100644
--- a/spec/quality_spec.rb
+++ b/spec/quality_spec.rb
@@ -214,6 +214,9 @@ RSpec.describe "The library itself" do
begin
gem_command! :build, "bundler.gemspec"
if Bundler.rubygems.provides?(">= 2.4")
+ # there's no way aroudn this warning
+ last_command.stderr.sub!(/^YAML safe loading.*/, "")
+
# older rubygems have weird warnings, and we won't actually be using them
# to build the gem for releases anyways
expect(last_command.stderr).to be_empty, "bundler should build as a gem without warnings, but\n#{err}"
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index cb9c764dfb..766ed8f955 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -3,6 +3,7 @@
$:.unshift File.expand_path("..", __FILE__)
$:.unshift File.expand_path("../../lib", __FILE__)
+require "rubygems"
require "bundler/psyched_yaml"
require "bundler/vendored_fileutils"
require "uri"
@@ -10,7 +11,6 @@ require "digest"
require File.expand_path("../support/path.rb", __FILE__)
begin
- require "rubygems"
spec = Gem::Specification.load("bundler.gemspec")
rspec = spec.dependencies.find {|d| d.name == "rspec" }
gem "rspec", rspec.requirement.to_s