Fix destroy document specs

We were linking to the document url itself, which does not have a route
associated and so the specs fails

With this commit we are using the correct path to the destroy action of
the DocumentsController.

We are also using the referrer instead of a params[:from] attribute, as
it avoids having to pass an extra parameter, making the code prettier
and it works the same way
This commit is contained in:
rgarcia
2018-05-09 18:59:35 +02:00
committed by decabeza
parent b588cd3a0b
commit dacc2d529d
2 changed files with 3 additions and 2 deletions

View File

@@ -11,7 +11,7 @@ class DocumentsController < ApplicationController
else
flash[:alert] = t "documents.actions.destroy.alert"
end
redirect_to params[:from]
redirect_to request.referer
end
format.js do
if @document.destroy