Skip to content

Commit c52269b

Browse files
committed
1 parent e06caeb commit c52269b

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

spec/rubocop/rspec/hook_spec.rb

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,32 @@ def metadata(source)
7474
hook(source).metadata.to_s
7575
end
7676

77+
if RUBY_VERSION >= '3.4'
78+
let(:expected_special) { 's(:sym, :special) => true' }
79+
let(:expected_symbol) { 's(:sym, :symbol) => true' }
80+
else
81+
let(:expected_special) { 's(:sym, :special)=>true' }
82+
let(:expected_symbol) { 's(:sym, :symbol)=>true' }
83+
end
84+
7785
it 'extracts symbol metadata' do
7886
expect(metadata('before(:example, :special) { foo }'))
79-
.to eq('{s(:sym, :special)=>true}')
87+
.to eq("{#{expected_special}}")
8088
end
8189

8290
it 'extracts hash metadata' do
8391
expect(metadata('before(:example, special: true) { foo }'))
84-
.to eq('{s(:sym, :special)=>true}')
92+
.to eq("{#{expected_special}}")
8593
end
8694

8795
it 'combines symbol and hash metadata' do
8896
expect(metadata('before(:example, :symbol, special: true) { foo }'))
89-
.to eq('{s(:sym, :symbol)=>true, s(:sym, :special)=>true}')
97+
.to eq("{#{expected_symbol}, #{expected_special}}")
9098
end
9199

92100
it 'extracts hash metadata with no scope given' do
93101
expect(metadata('before(special: true) { foo }'))
94-
.to eq('{s(:sym, :special)=>true}')
102+
.to eq("{#{expected_special}}")
95103
end
96104

97105
it 'withstands no arguments' do

0 commit comments

Comments
 (0)