Add coverage for more admin/domain_blocks scenarios (#35590)

This commit is contained in:
Matt Jankowski 2025-07-30 04:52:47 -04:00 committed by GitHub
parent 1c89309db0
commit ba9fa54f9c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -57,6 +57,30 @@ RSpec.describe 'blocking domains through the moderation interface' do
end
end
context 'when suspending an already suspended domain and using a lower severity' do
before { Fabricate :domain_block, domain: 'example.com', severity: 'silence' }
it 'warns about downgrade and does not update' do
visit new_admin_domain_block_path
submit_domain_block('example.com', 'noop')
expect(page)
.to have_content(/You have already imposed stricter limits on example.com/)
end
end
context 'when failing to provide a domain value' do
it 'provides an error about the missing value' do
visit new_admin_domain_block_path
submit_domain_block('', 'noop')
expect(page)
.to have_content(/review the error below/)
end
end
context 'when suspending a subdomain of an already-silenced domain' do
it 'presents a confirmation screen before suspending the domain' do
domain_block = Fabricate(:domain_block, domain: 'example.com', severity: 'silence')