mirror of
https://github.com/mastodon/mastodon
synced 2024-11-24 07:06:18 +09:00
Prevent triple-subject run in admin/domain_blocks spec (#28195)
This commit is contained in:
parent
154fb95e44
commit
19ad51253d
@ -192,16 +192,11 @@ RSpec.describe Admin::DomainBlocksController do
|
||||
let(:original_severity) { 'suspend' }
|
||||
let(:new_severity) { 'silence' }
|
||||
|
||||
it 'changes the block severity' do
|
||||
expect { subject }.to change { domain_block.reload.severity }.from('suspend').to('silence')
|
||||
end
|
||||
|
||||
it 'undoes individual suspensions' do
|
||||
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)
|
||||
it 'changes the block severity, suspensions, and silences' do
|
||||
expect { subject }
|
||||
.to change_severity('suspend', 'silence')
|
||||
.and change_suspended(true, false)
|
||||
.and change_silenced(false, true)
|
||||
end
|
||||
end
|
||||
|
||||
@ -209,17 +204,26 @@ RSpec.describe Admin::DomainBlocksController do
|
||||
let(:original_severity) { 'silence' }
|
||||
let(:new_severity) { 'suspend' }
|
||||
|
||||
it 'changes the block severity' do
|
||||
expect { subject }.to change { domain_block.reload.severity }.from('silence').to('suspend')
|
||||
it 'changes the block severity, silences, and suspensions' do
|
||||
expect { subject }
|
||||
.to change_severity('silence', 'suspend')
|
||||
.and change_silenced(true, false)
|
||||
.and change_suspended(false, true)
|
||||
end
|
||||
end
|
||||
|
||||
it 'undoes individual silences' do
|
||||
expect { subject }.to change { remote_account.reload.silenced? }.from(true).to(false)
|
||||
private
|
||||
|
||||
def change_severity(from, to)
|
||||
change { domain_block.reload.severity }.from(from).to(to)
|
||||
end
|
||||
|
||||
it 'performs individual suspends' do
|
||||
expect { subject }.to change { remote_account.reload.suspended? }.from(false).to(true)
|
||||
def change_silenced(from, to)
|
||||
change { remote_account.reload.silenced? }.from(from).to(to)
|
||||
end
|
||||
|
||||
def change_suspended(from, to)
|
||||
change { remote_account.reload.suspended? }.from(from).to(to)
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user