mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-02-02 21:13:02 -05:00
Use expect
in Admin::ExportControllerConcern
import params (#33745)
This commit is contained in:
parent
65d9171c7d
commit
d3b637c757
@ -24,6 +24,6 @@ module Admin::ExportControllerConcern
|
|||||||
end
|
end
|
||||||
|
|
||||||
def import_params
|
def import_params
|
||||||
params.require(:admin_import).permit(:data)
|
params.expect(admin_import: [:data])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
16
spec/requests/admin/export_domain_allows_spec.rb
Normal file
16
spec/requests/admin/export_domain_allows_spec.rb
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe 'Admin Export Domain Allows' do
|
||||||
|
describe 'POST /admin/export_domain_allows/import' do
|
||||||
|
before { sign_in Fabricate(:admin_user) }
|
||||||
|
|
||||||
|
it 'gracefully handles invalid nested params' do
|
||||||
|
post import_admin_export_domain_allows_path(admin_import: 'invalid')
|
||||||
|
|
||||||
|
expect(response)
|
||||||
|
.to redirect_to(admin_instances_path)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
16
spec/requests/admin/export_domain_blocks_spec.rb
Normal file
16
spec/requests/admin/export_domain_blocks_spec.rb
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe 'Admin Export Domain Blocks' do
|
||||||
|
describe 'POST /admin/export_domain_blocks/import' do
|
||||||
|
before { sign_in Fabricate(:admin_user) }
|
||||||
|
|
||||||
|
it 'gracefully handles invalid nested params' do
|
||||||
|
post import_admin_export_domain_blocks_path(admin_import: 'invalid')
|
||||||
|
|
||||||
|
expect(response.body)
|
||||||
|
.to include(I18n.t('admin.export_domain_blocks.no_file'))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user