From 32223863a51472d929c57d22dbffc5d9c9fafa79 Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 21 May 2024 15:17:34 +0200 Subject: [PATCH] Add coverage to `/admin/accounts/:id` (#30386) --- .../admin/accounts_controller_spec.rb | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/spec/controllers/admin/accounts_controller_spec.rb b/spec/controllers/admin/accounts_controller_spec.rb index b90bb414b0..f241d261b1 100644 --- a/spec/controllers/admin/accounts_controller_spec.rb +++ b/spec/controllers/admin/accounts_controller_spec.rb @@ -53,11 +53,32 @@ RSpec.describe Admin::AccountsController do describe 'GET #show' do let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } - let(:account) { Fabricate(:account) } - it 'returns http success' do - get :show, params: { id: account.id } - expect(response).to have_http_status(200) + context 'with a remote account' do + let(:account) { Fabricate(:account, domain: 'example.com') } + + it 'returns http success' do + get :show, params: { id: account.id } + expect(response).to have_http_status(200) + end + end + + context 'with a local account' do + let(:account) { Fabricate(:account, domain: nil) } + + it 'returns http success' do + get :show, params: { id: account.id } + expect(response).to have_http_status(200) + end + end + + context 'with a local deleted account' do + let(:account) { Fabricate(:account, domain: nil, user: nil) } + + it 'returns http success' do + get :show, params: { id: account.id } + expect(response).to have_http_status(200) + end end end