summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2017-06-13 15:47:57 -0500
committerSamuel Giddins <segiddins@segiddins.me>2017-08-17 23:43:22 -0400
commitac7b13838aa1314964405a2586f2769d0cb041b4 (patch)
treea8190df9432abf19f2185a564f821a926029a91c
parent1f4e890304a5dae7c83d40305e2d878ca7c0362e (diff)
downloadbundler-ac7b13838aa1314964405a2586f2769d0cb041b4.tar.gz
Allow simulating different RubyGems versions in the specs
-rw-r--r--spec/support/hax.rb5
-rw-r--r--spec/support/helpers.rb8
2 files changed, 13 insertions, 0 deletions
diff --git a/spec/support/hax.rb b/spec/support/hax.rb
index a3fe041c82..d1cea40922 100644
--- a/spec/support/hax.rb
+++ b/spec/support/hax.rb
@@ -3,6 +3,11 @@
require "rubygems"
module Gem
+ if version = ENV["BUNDLER_SPEC_RUBYGEMS_VERSION"]
+ remove_const(:VERSION) if const_defined?(:VERSION)
+ VERSION = version
+ end
+
class Platform
@local = new(ENV["BUNDLER_SPEC_PLATFORM"]) if ENV["BUNDLER_SPEC_PLATFORM"]
end
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index a0b46bfad7..08c3c5e921 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -481,6 +481,14 @@ module Spec
ENV["BUNDLER_SPEC_VERSION"] = old if block_given?
end
+ def simulate_rubygems_version(version)
+ old = ENV["BUNDLER_SPEC_RUBYGEMS_VERSION"]
+ ENV["BUNDLER_SPEC_RUBYGEMS_VERSION"] = version.to_s
+ yield if block_given?
+ ensure
+ ENV["BUNDLER_SPEC_RUBYGEMS_VERSION"] = old if block_given?
+ end
+
def simulate_windows
old = ENV["BUNDLER_SPEC_WINDOWS"]
ENV["BUNDLER_SPEC_WINDOWS"] = "true"