Skip to content

Commit 11cd4a9

Browse files
committed
Align code with RSpec/HaveAttributes
1 parent 4467c3c commit 11cd4a9

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

spec/rubocop/cop/rspec/mixin/location_help_spec.rb

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,32 @@
1212
let(:source) { 'a b' }
1313

1414
it 'returns #<Parser::Source::Range (string) 1...3>' do
15-
expect(arguments_with_whitespace.begin_pos).to eq 1
16-
expect(arguments_with_whitespace.end_pos).to eq 3
15+
expect(arguments_with_whitespace).to have_attributes(
16+
begin_pos: 1,
17+
end_pos: 3
18+
)
1719
end
1820
end
1921

2022
context 'when `foo 1, 2`' do
2123
let(:source) { 'foo 1, 2' }
2224

2325
it 'returns #<Parser::Source::Range (string) 3...8>' do
24-
expect(arguments_with_whitespace.begin_pos).to eq 3
25-
expect(arguments_with_whitespace.end_pos).to eq 8
26+
expect(arguments_with_whitespace).to have_attributes(
27+
begin_pos: 3,
28+
end_pos: 8
29+
)
2630
end
2731
end
2832

2933
context 'when `foo(bar, baz)`' do
3034
let(:source) { 'foo(bar, baz)' }
3135

3236
it 'returns #<Parser::Source::Range (string) 3...13>' do
33-
expect(arguments_with_whitespace.begin_pos).to eq 3
34-
expect(arguments_with_whitespace.end_pos).to eq 13
37+
expect(arguments_with_whitespace).to have_attributes(
38+
begin_pos: 3,
39+
end_pos: 13
40+
)
3541
end
3642
end
3743
end
@@ -64,8 +70,10 @@
6470
let(:source) { 'a { b }' }
6571

6672
it 'returns #<Parser::Source::Range (string) 1...7>' do
67-
expect(block_with_whitespace.begin_pos).to eq 1
68-
expect(block_with_whitespace.end_pos).to eq 7
73+
expect(block_with_whitespace).to have_attributes(
74+
begin_pos: 1,
75+
end_pos: 7
76+
)
6977
end
7078
end
7179

@@ -74,8 +82,10 @@
7482
let(:source) { 'foo { bar + baz }' }
7583

7684
it 'returns #<Parser::Source::Range (string) 3...17>' do
77-
expect(block_with_whitespace.begin_pos).to eq 3
78-
expect(block_with_whitespace.end_pos).to eq 17
85+
expect(block_with_whitespace).to have_attributes(
86+
begin_pos: 3,
87+
end_pos: 17
88+
)
7989
end
8090
end
8191
end

0 commit comments

Comments
 (0)