From 645a55f19b71bb951f3ce7c3a7915ce878f82e97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Fri, 10 Mar 2017 03:28:20 +0100 Subject: Introduce a new middleware for the test environment that can block requests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The idea is that after each feature spec example, we block all incoming requests at the Rack level, go to the 'about:blank' page, and wait until the current requests reach 0. This should solve the problem where a request would end after database cleaner performed the database truncation. The problem was that a GET request can still lead to records creation (e.g. namespaces or routes). Signed-off-by: Rémy Coutable --- config/environments/test.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'config') diff --git a/config/environments/test.rb b/config/environments/test.rb index fb25d3a8b14..a25c5016a3b 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,4 +1,7 @@ Rails.application.configure do + # Make sure the middleware is inserted first in middleware chain + config.middleware.insert_before('ActionDispatch::Static', 'Gitlab::Testing::RequestBlockerMiddleware') + # Settings specified here will take precedence over those in config/application.rb # The test environment is used exclusively to run your application's -- cgit v1.2.3