RSpec/UselessDynamicDefinition: Fix offenses for error tracking specs
What does this MR do and why?
This MR fixes RuboCop
-
RSpec/UselessDynamicDefinition
- see #406761 (closed) RSpec/ContextWording
RSpec/ExpectInHook
RSpec/MissingFeatureCategory
RSpec/ReturnFromStub
It also lets the specs run in random order.
How to set up and validate locally
bundle exec rubocop spec/lib/gitlab/error_tracking_spec.rb
# Reproduce failures due to order-dependency
git checkout master
bin/rspec ./spec/lib/gitlab/error_tracking_spec.rb[1:2:2,1:4:2,1:5:1:2] --seed 31992
# FAILURE
# On this branch
bin/rspec ./spec/lib/gitlab/error_tracking_spec.rb[1:2:2,1:4:2,1:5:1:2] --seed 31992
# PASSES
bin/rspec spec/lib/gitlab/error_tracking_spec.rb
# Run specs 10 times to verify that it's no longer order-dependent
for i in $(seq 1 10); do bin/rspec spec/lib/gitlab/error_tracking_spec.rb || break; done
echo $? # => 0
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #406761 (closed)
Edited by Peter Leitzen