0
0
Fork 0

Fix log out from user menu not working on Safari (#31402)

This commit is contained in:
Renaud Chaput 2024-08-13 19:49:23 +02:00 committed by GitHub
parent 2b1670da48
commit c3e1d86d58
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 102 additions and 34 deletions

View file

@ -0,0 +1,30 @@
# frozen_string_literal: true
require 'rails_helper'
describe 'Log Out' do
include RoutingHelper
describe 'DELETE /auth/sign_out' do
let(:user) { Fabricate(:user) }
before do
sign_in user
end
it 'Logs out the user and redirect' do
delete '/auth/sign_out'
expect(response).to redirect_to('/auth/sign_in')
end
it 'Logs out the user and return a page to redirect to with a JSON request' do
delete '/auth/sign_out', headers: { 'HTTP_ACCEPT' => 'application/json' }
expect(response).to have_http_status(200)
expect(response.media_type).to eq 'application/json'
expect(body_as_json[:redirect_to]).to eq '/auth/sign_in'
end
end
end