mirror of
https://github.com/mastodon/mastodon
synced 2025-01-23 02:03:31 +09:00
Expand coverage of admin/*blocks
areas (#33594)
This commit is contained in:
parent
68c9f91ccb
commit
9f03e5b53a
@ -5,9 +5,7 @@ require 'rails_helper'
|
||||
RSpec.describe 'Admin::EmailDomainBlocks' do
|
||||
let(:current_user) { Fabricate(:admin_user) }
|
||||
|
||||
before do
|
||||
sign_in current_user
|
||||
end
|
||||
before { sign_in current_user }
|
||||
|
||||
describe 'Performing batch updates' do
|
||||
before do
|
||||
@ -22,6 +20,27 @@ RSpec.describe 'Admin::EmailDomainBlocks' do
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a selected block' do
|
||||
let!(:email_domain_block) { Fabricate :email_domain_block }
|
||||
|
||||
it 'deletes the block' do
|
||||
visit admin_email_domain_blocks_path
|
||||
|
||||
check_item
|
||||
|
||||
expect { click_on button_for_delete }
|
||||
.to change(EmailDomainBlock, :count).by(-1)
|
||||
expect { email_domain_block.reload }
|
||||
.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
end
|
||||
|
||||
def check_item
|
||||
within '.batch-table__row' do
|
||||
find('input[type=checkbox]').check
|
||||
end
|
||||
end
|
||||
|
||||
def button_for_delete
|
||||
I18n.t('admin.email_domain_blocks.delete')
|
||||
end
|
||||
|
@ -48,6 +48,27 @@ RSpec.describe 'Admin::IpBlocks' do
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a selected block' do
|
||||
let!(:ip_block) { Fabricate :ip_block }
|
||||
|
||||
it 'deletes the block' do
|
||||
visit admin_ip_blocks_path
|
||||
|
||||
check_item
|
||||
|
||||
expect { click_on button_for_delete }
|
||||
.to change(IpBlock, :count).by(-1)
|
||||
expect { ip_block.reload }
|
||||
.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
end
|
||||
|
||||
def check_item
|
||||
within '.batch-table__row' do
|
||||
find('input[type=checkbox]').check
|
||||
end
|
||||
end
|
||||
|
||||
def button_for_delete
|
||||
I18n.t('admin.ip_blocks.delete')
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user