From ba9fa54f9c0c7be46ca5ba4d8285b52f7976516a Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Wed, 30 Jul 2025 04:52:47 -0400 Subject: [PATCH] Add coverage for more admin/domain_blocks scenarios (#35590) --- spec/system/admin/domain_blocks_spec.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/spec/system/admin/domain_blocks_spec.rb b/spec/system/admin/domain_blocks_spec.rb index 56a5d1198..c309e39a4 100644 --- a/spec/system/admin/domain_blocks_spec.rb +++ b/spec/system/admin/domain_blocks_spec.rb @@ -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')