Skip to content
Snippets Groups Projects
Commit 2ca1f073 authored by Eugen Rochko's avatar Eugen Rochko Committed by GitHub
Browse files

Fix Devise destroy method being available to delete user record (#3266)

(You may think that we need account deletions, but this way would've just orphaned the db records)
parent 19ecde8f
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,10 @@ class Auth::RegistrationsController < Devise::RegistrationsController
before_action :check_enabled_registrations, only: [:new, :create]
before_action :configure_sign_up_params, only: [:create]
def destroy
not_found
end
protected
def build_resource(hash = nil)
......
......@@ -35,4 +35,22 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
expect(user.locale).to eq(accept_language)
end
end
describe 'DELETE #destroy' do
let(:user) { Fabricate(:user) }
before do
request.env['devise.mapping'] = Devise.mappings[:user]
sign_in(user, scope: :user)
delete :destroy
end
it 'returns http not found' do
expect(response).to have_http_status(:not_found)
end
it 'does not delete user' do
expect(User.find(user.id)).to_not be_nil
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment