Introduce a new middleware for the test environment that can block requests
What does this MR do?
After digging into https://gitlab.com/gitlab-org/gitlab-ce/issues/28307#note_24958837, I thought there is probably a clean and robust solution to this issue other than tweaking assertions on a case-by-case basis...
And then I found http://www.salsify.com/blog/engineering/tearing-capybara-ajax-tests. I implemented what's described in the article and I've never experienced a PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_routes_on_source_type_and_source_id"
error again!
Are there points in the code the reviewer needs to double check?
I don't there is any downside with this technique.
Closes #28307 (closed)