From c52269be7e13daee673feb250a66089388eee9e7 Mon Sep 17 00:00:00 2001 From: ydah Date: Mon, 14 Oct 2024 11:09:01 +0900 Subject: [PATCH] Fix a failed test in hook_spec.rb use ruby-head see: https://github.com/rubocop/rubocop-rspec/actions/runs/11319581327/job/31475851856 --- spec/rubocop/rspec/hook_spec.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/spec/rubocop/rspec/hook_spec.rb b/spec/rubocop/rspec/hook_spec.rb index dffb7d63d..ad9493527 100644 --- a/spec/rubocop/rspec/hook_spec.rb +++ b/spec/rubocop/rspec/hook_spec.rb @@ -74,24 +74,32 @@ def metadata(source) hook(source).metadata.to_s end + if RUBY_VERSION >= '3.4' + let(:expected_special) { 's(:sym, :special) => true' } + let(:expected_symbol) { 's(:sym, :symbol) => true' } + else + let(:expected_special) { 's(:sym, :special)=>true' } + let(:expected_symbol) { 's(:sym, :symbol)=>true' } + end + it 'extracts symbol metadata' do expect(metadata('before(:example, :special) { foo }')) - .to eq('{s(:sym, :special)=>true}') + .to eq("{#{expected_special}}") end it 'extracts hash metadata' do expect(metadata('before(:example, special: true) { foo }')) - .to eq('{s(:sym, :special)=>true}') + .to eq("{#{expected_special}}") end it 'combines symbol and hash metadata' do expect(metadata('before(:example, :symbol, special: true) { foo }')) - .to eq('{s(:sym, :symbol)=>true, s(:sym, :special)=>true}') + .to eq("{#{expected_symbol}, #{expected_special}}") end it 'extracts hash metadata with no scope given' do expect(metadata('before(special: true) { foo }')) - .to eq('{s(:sym, :special)=>true}') + .to eq("{#{expected_special}}") end it 'withstands no arguments' do