1
0
mirror of https://github.com/mastodon/mastodon synced 2024-11-28 06:48:28 +09:00

Prevent triple-subject run in admin/domain_blocks spec (#28195)

This commit is contained in:
Matt Jankowski 2023-12-04 04:02:40 -05:00 committed by GitHub
parent 154fb95e44
commit 19ad51253d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -192,16 +192,11 @@ RSpec.describe Admin::DomainBlocksController do
let(:original_severity) { 'suspend' } let(:original_severity) { 'suspend' }
let(:new_severity) { 'silence' } let(:new_severity) { 'silence' }
it 'changes the block severity' do it 'changes the block severity, suspensions, and silences' do
expect { subject }.to change { domain_block.reload.severity }.from('suspend').to('silence') expect { subject }
end .to change_severity('suspend', 'silence')
.and change_suspended(true, false)
it 'undoes individual suspensions' do .and change_silenced(false, true)
expect { subject }.to change { remote_account.reload.suspended? }.from(true).to(false)
end
it 'performs individual silences' do
expect { subject }.to change { remote_account.reload.silenced? }.from(false).to(true)
end end
end end
@ -209,17 +204,26 @@ RSpec.describe Admin::DomainBlocksController do
let(:original_severity) { 'silence' } let(:original_severity) { 'silence' }
let(:new_severity) { 'suspend' } let(:new_severity) { 'suspend' }
it 'changes the block severity' do it 'changes the block severity, silences, and suspensions' do
expect { subject }.to change { domain_block.reload.severity }.from('silence').to('suspend') expect { subject }
.to change_severity('silence', 'suspend')
.and change_silenced(true, false)
.and change_suspended(false, true)
end
end end
it 'undoes individual silences' do private
expect { subject }.to change { remote_account.reload.silenced? }.from(true).to(false)
def change_severity(from, to)
change { domain_block.reload.severity }.from(from).to(to)
end end
it 'performs individual suspends' do def change_silenced(from, to)
expect { subject }.to change { remote_account.reload.suspended? }.from(false).to(true) change { remote_account.reload.silenced? }.from(from).to(to)
end end
def change_suspended(from, to)
change { remote_account.reload.suspended? }.from(from).to(to)
end end
end end