mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Check response body instead of assigns in admin export domain blocks controller spec
This commit is contained in:
parent
6197fb5ca5
commit
575babaee5
1 changed files with 12 additions and 10 deletions
|
@ -42,11 +42,8 @@ RSpec.describe Admin::ExportDomainBlocksController do
|
|||
post :import, params: { admin_import: { data: fixture_file_upload('domain_blocks.csv') } }
|
||||
end
|
||||
|
||||
it 'renders page with expected domain blocks' do
|
||||
expect(assigns(:domain_blocks).map { |block| [block.domain, block.severity.to_sym] }).to contain_exactly(['bad.domain', :silence], ['worse.domain', :suspend], ['reject.media', :noop])
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
it 'renders page with expected domain blocks and returns http success' do
|
||||
expect(mapped_batch_table_rows).to contain_exactly(['bad.domain', :silence], ['worse.domain', :suspend], ['reject.media', :noop])
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
@ -56,14 +53,19 @@ RSpec.describe Admin::ExportDomainBlocksController do
|
|||
post :import, params: { admin_import: { data: fixture_file_upload('domain_blocks_list.txt') } }
|
||||
end
|
||||
|
||||
it 'renders page with expected domain blocks' do
|
||||
expect(assigns(:domain_blocks).map { |block| [block.domain, block.severity.to_sym] }).to contain_exactly(['bad.domain', :suspend], ['worse.domain', :suspend], ['reject.media', :suspend])
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
it 'renders page with expected domain blocks and returns http success' do
|
||||
expect(mapped_batch_table_rows).to contain_exactly(['bad.domain', :suspend], ['worse.domain', :suspend], ['reject.media', :suspend])
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
||||
def mapped_batch_table_rows
|
||||
batch_table_rows.map { |row| [row.at_css('[id$=_domain]')['value'], row.at_css('[id$=_severity]')['value'].to_sym] }
|
||||
end
|
||||
|
||||
def batch_table_rows
|
||||
Nokogiri::Slop(response.body).css('body div.batch-table__row')
|
||||
end
|
||||
end
|
||||
|
||||
it 'displays error on no file selected' do
|
||||
|
|
Loading…
Reference in a new issue