diff --git a/lib/rspec/support/ruby_features.rb b/lib/rspec/support/ruby_features.rb index 20e58075a..ea4033df6 100644 --- a/lib/rspec/support/ruby_features.rb +++ b/lib/rspec/support/ruby_features.rb @@ -47,6 +47,10 @@ def non_mri? def mri? !defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby' end + + def truffleruby? + defined?(RUBY_ENGINE) && RUBY_ENGINE == 'truffleruby' + end end # @api private @@ -101,7 +105,7 @@ def supports_taint? end ripper_requirements = [ComparableVersion.new(RUBY_VERSION) >= '1.9.2'] - ripper_requirements.push(false) if Ruby.rbx? + ripper_requirements.push(false) if Ruby.rbx? || Ruby.truffleruby? if Ruby.jruby? ripper_requirements.push(Ruby.jruby_version >= '1.7.5') diff --git a/spec/rspec/support/ruby_features_spec.rb b/spec/rspec/support/ruby_features_spec.rb index 10fc1525e..fd53035ab 100644 --- a/spec/rspec/support/ruby_features_spec.rb +++ b/spec/rspec/support/ruby_features_spec.rb @@ -111,7 +111,7 @@ def ripper_is_implemented? in_sub_process_if_possible do begin require 'ripper' - !!defined?(::Ripper) + !!defined?(::Ripper) && Ripper.respond_to?(:lex) rescue LoadError false end