Skip to content

Commit

Permalink
Update ripper_supported? for truffleruby and ripper specs to only run…
Browse files Browse the repository at this point in the history
… when supported
  • Loading branch information
bjfish committed Jan 13, 2020
1 parent 596198a commit e183117
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/rspec/support/ruby_features.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand Down
6 changes: 5 additions & 1 deletion spec/rspec/support/ruby_features_spec.rb
Expand Up @@ -123,6 +123,10 @@ def ripper_works_correctly?
ripper_can_parse_source_including_keywordish_symbol?
end

def self.ripper_supported?
RubyFeatures.ripper_supported?
end

# https://github.com/jruby/jruby/issues/3386
def ripper_reports_correct_line_number?
in_sub_process_if_possible do
Expand All @@ -144,7 +148,7 @@ def ripper_can_parse_source_including_keywordish_symbol?
end
end

it 'returns whether Ripper is correctly implemented in the current environment' do
it 'returns whether Ripper is correctly implemented in the current environment', :if => ripper_supported? do
expect(RubyFeatures.ripper_supported?).to eq(ripper_is_implemented? && ripper_works_correctly?)
end

Expand Down

0 comments on commit e183117

Please sign in to comment.