summaryrefslogtreecommitdiff
path: root/spec/bundler
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2019-08-04 14:52:15 +0200
committerSHIBATA Hiroshi <hsbt@ruby-lang.org>2019-08-16 14:30:23 +0900
commit2b0f3aa095a410902b9b2e4fb14f909e0630c1a1 (patch)
tree6901f30fc32837107c3fb1771a49ec9e3cde93e6 /spec/bundler
parent6711343d5a630cc857f0fa503b403edb68415f48 (diff)
[bundler/bundler] Use the standard RUBY_ENGINE_VERSION instead of JRUBY_VERSION
* RUBY_ENGINE and RUBY_ENGINE_VERSION are defined on every modern Ruby. * There is no such constant as TRUFFLERUBY_VERSION or RBX_VERSION. https://github.com/bundler/bundler/commit/f9d910403b
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2366
Diffstat (limited to 'spec/bundler')
-rw-r--r--spec/bundler/bundler/ruby_version_spec.rb20
-rw-r--r--spec/bundler/support/hax.rb6
-rw-r--r--spec/bundler/support/platforms.rb11
3 files changed, 13 insertions, 24 deletions
diff --git a/spec/bundler/bundler/ruby_version_spec.rb b/spec/bundler/bundler/ruby_version_spec.rb
index ef1a5fe575..868d81088d 100644
--- a/spec/bundler/bundler/ruby_version_spec.rb
+++ b/spec/bundler/bundler/ruby_version_spec.rb
@@ -427,7 +427,7 @@ RSpec.describe "Bundler::RubyVersion and its subclasses" do
describe "#engine" do
before { stub_const("RUBY_ENGINE", "jruby") }
- before { stub_const("JRUBY_VERSION", "2.1.1") }
+ before { stub_const("RUBY_ENGINE_VERSION", "2.1.1") }
it "should return a copy of the value of RUBY_ENGINE" do
expect(subject.engine).to eq("jruby")
@@ -438,37 +438,37 @@ RSpec.describe "Bundler::RubyVersion and its subclasses" do
describe "#engine_version" do
context "engine is ruby" do
before do
- stub_const("RUBY_VERSION", "2.2.4")
+ stub_const("RUBY_ENGINE_VERSION", "2.2.4")
stub_const("RUBY_ENGINE", "ruby")
end
- it "should return a copy of the value of RUBY_VERSION" do
+ it "should return a copy of the value of RUBY_ENGINE_VERSION" do
expect(bundler_system_ruby_version.engine_versions).to eq(["2.2.4"])
- expect(bundler_system_ruby_version.engine_versions.first).to_not be(RUBY_VERSION)
+ expect(bundler_system_ruby_version.engine_versions.first).to_not be(RUBY_ENGINE_VERSION)
end
end
context "engine is rbx" do
before do
stub_const("RUBY_ENGINE", "rbx")
- stub_const("Rubinius::VERSION", "2.0.0")
+ stub_const("RUBY_ENGINE_VERSION", "2.0.0")
end
- it "should return a copy of the value of Rubinius::VERSION" do
+ it "should return a copy of the value of RUBY_ENGINE_VERSION" do
expect(bundler_system_ruby_version.engine_versions).to eq(["2.0.0"])
- expect(bundler_system_ruby_version.engine_versions.first).to_not be(Rubinius::VERSION)
+ expect(bundler_system_ruby_version.engine_versions.first).to_not be(RUBY_ENGINE_VERSION)
end
end
context "engine is jruby" do
before do
stub_const("RUBY_ENGINE", "jruby")
- stub_const("JRUBY_VERSION", "2.1.1")
+ stub_const("RUBY_ENGINE_VERSION", "2.1.1")
end
- it "should return a copy of the value of JRUBY_VERSION" do
+ it "should return a copy of the value of RUBY_ENGINE_VERSION" do
expect(subject.engine_versions).to eq(["2.1.1"])
- expect(bundler_system_ruby_version.engine_versions.first).to_not be(JRUBY_VERSION)
+ expect(bundler_system_ruby_version.engine_versions.first).to_not be(RUBY_ENGINE_VERSION)
end
end
diff --git a/spec/bundler/support/hax.rb b/spec/bundler/support/hax.rb
index 74daccc9db..4f8d9b89ec 100644
--- a/spec/bundler/support/hax.rb
+++ b/spec/bundler/support/hax.rb
@@ -53,9 +53,7 @@ class Object
remove_const :RUBY_ENGINE
RUBY_ENGINE = ENV["BUNDLER_SPEC_RUBY_ENGINE"]
- if RUBY_ENGINE == "jruby"
- remove_const :JRUBY_VERSION if defined?(JRUBY_VERSION)
- JRUBY_VERSION = ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"]
- end
+ remove_const :RUBY_ENGINE_VERSION
+ RUBY_ENGINE_VERSION = ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"]
end
end
diff --git a/spec/bundler/support/platforms.rb b/spec/bundler/support/platforms.rb
index 153704e666..f4d63c8ded 100644
--- a/spec/bundler/support/platforms.rb
+++ b/spec/bundler/support/platforms.rb
@@ -71,16 +71,7 @@ module Spec
def local_engine_version
return ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"] if ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"]
- case local_ruby_engine
- when "ruby"
- RUBY_VERSION
- when "rbx"
- Rubinius::VERSION
- when "jruby"
- JRUBY_VERSION
- else
- RUBY_ENGINE_VERSION
- end
+ RUBY_ENGINE_VERSION
end
def not_local_engine_version