Skip to content

Commit

Permalink
Try define shared contexts explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
viralpraxis committed Sep 23, 2024
1 parent 7a47d02 commit 5875668
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
29 changes: 29 additions & 0 deletions spec/shared_contexts.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frozen_string_literal: true

RSpec.shared_context 'ruby 2.7' do
# Prism supports parsing Ruby 3.3+.
let(:ruby_version) { ENV['PARSER_ENGINE'] == 'parser_prism' ? 3.3 : 2.7 }
end

RSpec.shared_context 'ruby 3.0' do
# Prism supports parsing Ruby 3.3+.
let(:ruby_version) { ENV['PARSER_ENGINE'] == 'parser_prism' ? 3.3 : 3.0 }
end

RSpec.shared_context 'ruby 3.1' do
# Prism supports parsing Ruby 3.3+.
let(:ruby_version) { ENV['PARSER_ENGINE'] == 'parser_prism' ? 3.3 : 3.1 }
end

RSpec.shared_context 'ruby 3.2' do
# Prism supports parsing Ruby 3.3+.
let(:ruby_version) { ENV['PARSER_ENGINE'] == 'parser_prism' ? 3.3 : 3.2 }
end

RSpec.shared_context 'ruby 3.3' do
let(:ruby_version) { 3.3 }
end

RSpec.shared_context 'ruby 3.4' do
let(:ruby_version) { 3.4 }
end
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
require 'rubocop-thread_safety'

require 'rubocop/rspec/support'
require_relative 'shared_contexts'

RSpec.configure do |config|
config.include RuboCop::RSpec::ExpectOffense
Expand Down

0 comments on commit 5875668

Please sign in to comment.