0
0
Fork 0

Speed-up in Settings:: controllers specs (#27808)

This commit is contained in:
Matt Jankowski 2023-11-10 10:13:42 -05:00 committed by GitHub
parent ac62b995ef
commit 9dc3ce878b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 65 additions and 216 deletions

View file

@ -14,22 +14,16 @@ describe Settings::DeletesController do
get :show
end
it 'renders confirmation page' do
it 'renders confirmation page with private cache control headers', :aggregate_failures do
expect(response).to have_http_status(200)
end
it 'returns private cache control headers' do
expect(response.headers['Cache-Control']).to include('private, no-store')
end
context 'when suspended' do
let(:user) { Fabricate(:user, account_attributes: { suspended_at: Time.now.utc }) }
it 'returns http forbidden' do
it 'returns http forbidden with private cache control headers', :aggregate_failures do
expect(response).to have_http_status(403)
end
it 'returns private cache control headers' do
expect(response.headers['Cache-Control']).to include('private, no-store')
end
end
@ -56,19 +50,10 @@ describe Settings::DeletesController do
delete :destroy, params: { form_delete_confirmation: { password: 'petsmoldoggos' } }
end
it 'redirects to sign in page' do
it 'removes user record and redirects', :aggregate_failures do
expect(response).to redirect_to '/auth/sign_in'
end
it 'removes user record' do
expect(User.find_by(id: user.id)).to be_nil
end
it 'marks account as suspended' do
expect(user.account.reload).to be_suspended
end
it 'does not create an email block' do
expect(CanonicalEmailBlock.block?(user.email)).to be false
end