summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-06-10 02:02:30 -0500
committerSamuel Giddins <segiddins@segiddins.me>2016-06-10 02:02:30 -0500
commit4f8a41a3e8aaf0697c9b1d57cceee26df212841e (patch)
tree8529a785b7a9469b114ab1644fcff0367a81621d
parent9dbe160f9821d1c27a7dc1cd9532e754cb74e96d (diff)
downloadbundler-seg-allow-unlocking-when-removing-ruby.tar.gz
Fix stubbing RUBY_VERSION on 1.8.7seg-allow-unlocking-when-removing-ruby
-rw-r--r--lib/bundler/ruby_version.rb6
-rw-r--r--spec/support/hax.rb5
2 files changed, 4 insertions, 7 deletions
diff --git a/lib/bundler/ruby_version.rb b/lib/bundler/ruby_version.rb
index 9c1444485c..71174dc772 100644
--- a/lib/bundler/ruby_version.rb
+++ b/lib/bundler/ruby_version.rb
@@ -103,9 +103,11 @@ module Bundler
# not defined in ruby 1.8.7
"ruby"
end
+ # :sob: mocking RUBY_VERSION breaks stuff on 1.8.7
+ ruby_version = ENV.fetch("BUNDLER_SPEC_RUBY_VERSION") { RUBY_VERSION }.dup
ruby_engine_version = case ruby_engine
when "ruby"
- RUBY_VERSION.dup
+ ruby_version
when "rbx"
Rubinius::VERSION.dup
when "jruby"
@@ -113,7 +115,7 @@ module Bundler
else
raise BundlerError, "RUBY_ENGINE value #{RUBY_ENGINE} is not recognized"
end
- @ruby_version ||= RubyVersion.new(RUBY_VERSION.dup, RUBY_PATCHLEVEL.to_s, ruby_engine, ruby_engine_version)
+ @ruby_version ||= RubyVersion.new(ruby_version, RUBY_PATCHLEVEL.to_s, ruby_engine, ruby_engine_version)
end
private
diff --git a/spec/support/hax.rb b/spec/support/hax.rb
index b8bddc4248..2cca22c6ab 100644
--- a/spec/support/hax.rb
+++ b/spec/support/hax.rb
@@ -21,11 +21,6 @@ if ENV["BUNDLER_SPEC_WINDOWS"] == "true"
end
class Object
- if ENV["BUNDLER_SPEC_RUBY_VERSION"]
- remove_const :RUBY_VERSION if defined?(RUBY_VERSION)
- RUBY_VERSION = ENV["BUNDLER_SPEC_RUBY_VERSION"]
- end
-
if ENV["BUNDLER_SPEC_RUBY_ENGINE"]
if defined?(RUBY_ENGINE) && RUBY_ENGINE != "jruby" && ENV["BUNDLER_SPEC_RUBY_ENGINE"] == "jruby"
begin