Fix flaky spec: Don't destroy project created in let_it_be block
What does this MR do and why?
While working on another MR, I ran into a failing spec, which turns out to be flaky:
- we create a project using
let_it_be(:project)
- one of the specs destroys project (
project.destroy!
) - Another spec calls
let_it_be(:project)
so the project will be recreated
Specs that use project
between 2 and 3 can break due to the fact that the project has been removed from the database
On master
branch, I was able to reproduce this using
rspec --order random --seed 45791 ./spec/requests/api/internal/base_spec.rb
Fix:
- Create a project for the specs that need a destroyed project
- Remove the duplicate
let_it_be(:project)
call
Edited by Rutger Wessels