specs: properly use xhr: true in javascript requests

This avoids an unexpected `ActionController::InvalidCrossOriginRequest`
exception to be raised when the forgery protection is disabled.
This commit is contained in:
Pierre de La Morinerie 2021-06-22 09:37:48 +00:00
parent c20b8183a9
commit 5908b8019a
4 changed files with 26 additions and 28 deletions

View file

@ -12,7 +12,7 @@ describe AttachmentsController, type: :controller do
subject do
request.headers['HTTP_REFERER'] = dossier_url(dossier)
get :show, params: { id: attachment.id, signed_id: signed_id }, format: format
get :show, params: { id: attachment.id, signed_id: signed_id }, format: format, xhr: (format == :js)
end
context 'when authenticated' do