Aggregate spec examples to enable RSpec/AggregateExamples globally
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
The cop looks for opportunities to squash spec examples: https://www.rubydoc.info/gems/test-prof/0.11.2/RuboCop/Cop/RSpec/AggregateExamples
# bad
describe do
specify do
expect(number).to be_positive
expect(number).to be_odd
end
it { is_expected.to be_prime }
end
# good
describe do
specify do
expect(number).to be_positive
expect(number).to be_odd
is_expected.to be_prime
end
end
# fair - subject has side effects
describe do
specify do
expect(multiply_by(2)).to be_multiple_of(2)
end
specify do
expect(multiply_by(3)).to be_multiple_of(3)
end
end
It has been introduced in !42318 (closed) and has been disabled by default. The roll-out plan is to specify a file or directory to the Include section of the cop and auto-correct (or fix) the existing offenses.
MRs
Edited by 🤖 GitLab Bot 🤖