mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-18 20:39:32 +00:00
Add helper methods for domains allow and export blocks files (#28196)
This commit is contained in:
parent
3ec263bf15
commit
d848d8d87c
|
@ -24,7 +24,7 @@ RSpec.describe Admin::ExportDomainAllowsController do
|
||||||
|
|
||||||
get :export, params: { format: :csv }
|
get :export, params: { format: :csv }
|
||||||
expect(response).to have_http_status(200)
|
expect(response).to have_http_status(200)
|
||||||
expect(response.body).to eq(File.read(File.join(file_fixture_path, 'domain_allows.csv')))
|
expect(response.body).to eq(domain_allows_csv_file)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ RSpec.describe Admin::ExportDomainAllowsController do
|
||||||
# Domains should now be added
|
# Domains should now be added
|
||||||
get :export, params: { format: :csv }
|
get :export, params: { format: :csv }
|
||||||
expect(response).to have_http_status(200)
|
expect(response).to have_http_status(200)
|
||||||
expect(response.body).to eq(File.read(File.join(file_fixture_path, 'domain_allows.csv')))
|
expect(response.body).to eq(domain_allows_csv_file)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'displays error on no file selected' do
|
it 'displays error on no file selected' do
|
||||||
|
@ -49,4 +49,10 @@ RSpec.describe Admin::ExportDomainAllowsController do
|
||||||
expect(flash[:error]).to eq(I18n.t('admin.export_domain_allows.no_file'))
|
expect(flash[:error]).to eq(I18n.t('admin.export_domain_allows.no_file'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def domain_allows_csv_file
|
||||||
|
File.read(File.join(file_fixture_path, 'domain_allows.csv'))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,7 +26,13 @@ RSpec.describe Admin::ExportDomainBlocksController do
|
||||||
|
|
||||||
get :export, params: { format: :csv }
|
get :export, params: { format: :csv }
|
||||||
expect(response).to have_http_status(200)
|
expect(response).to have_http_status(200)
|
||||||
expect(response.body).to eq(File.read(File.join(file_fixture_path, 'domain_blocks.csv')))
|
expect(response.body).to eq(domain_blocks_csv_file)
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def domain_blocks_csv_file
|
||||||
|
File.read(File.join(file_fixture_path, 'domain_blocks.csv'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue