Merge remote-tracking branch 'parent/main' into kb_migration
This commit is contained in:
commit
69555645d9
68 changed files with 1214 additions and 618 deletions
|
@ -57,6 +57,30 @@ describe 'blocking domains through the moderation interface' do
|
|||
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')
|
||||
|
||||
visit new_admin_domain_block_path
|
||||
|
||||
fill_in 'domain_block_domain', with: 'subdomain.example.com'
|
||||
select I18n.t('admin.domain_blocks.new.severity.suspend'), from: 'domain_block_severity'
|
||||
click_on I18n.t('admin.domain_blocks.new.create')
|
||||
|
||||
# It presents a confirmation screen
|
||||
expect(page).to have_title(I18n.t('admin.domain_blocks.confirm_suspension.title', domain: 'subdomain.example.com'))
|
||||
|
||||
# Confirming creates the block
|
||||
click_on I18n.t('admin.domain_blocks.confirm_suspension.confirm')
|
||||
|
||||
expect(DomainBlock.where(domain: 'subdomain.example.com', severity: 'suspend')).to exist
|
||||
|
||||
# And leaves the previous block alone
|
||||
expect(domain_block.reload.severity).to eq 'silence'
|
||||
expect(domain_block.reload.domain).to eq 'example.com'
|
||||
end
|
||||
end
|
||||
|
||||
context 'when editing a domain block' do
|
||||
it 'presents a confirmation screen before suspending the domain' do
|
||||
domain_block = Fabricate(:domain_block, domain: 'example.com', severity: 'silence')
|
||||
|
|
|
@ -49,11 +49,7 @@ describe Admin::SystemCheck::ElasticsearchCheck do
|
|||
end
|
||||
|
||||
context 'when running version is missing' do
|
||||
before do
|
||||
client = instance_double(Elasticsearch::Transport::Client)
|
||||
allow(client).to receive(:info).and_raise(Elasticsearch::Transport::Transport::Error)
|
||||
allow(Chewy).to receive(:client).and_return(client)
|
||||
end
|
||||
before { stub_elasticsearch_error }
|
||||
|
||||
it 'returns false' do
|
||||
expect(check.pass?).to be false
|
||||
|
@ -86,6 +82,8 @@ describe Admin::SystemCheck::ElasticsearchCheck do
|
|||
end
|
||||
|
||||
context 'when running version is missing' do
|
||||
before { stub_elasticsearch_error }
|
||||
|
||||
it 'sends class name symbol to message instance' do
|
||||
allow(Admin::SystemCheck::Message).to receive(:new)
|
||||
.with(:elasticsearch_running_check)
|
||||
|
@ -97,4 +95,10 @@ describe Admin::SystemCheck::ElasticsearchCheck do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
def stub_elasticsearch_error
|
||||
client = instance_double(Elasticsearch::Transport::Client)
|
||||
allow(client).to receive(:info).and_raise(Elasticsearch::Transport::Transport::Error)
|
||||
allow(Chewy).to receive(:client).and_return(client)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue