Fix admin accounts CSV output

This commit is contained in:
Thiago Youssef 2022-03-14 12:12:22 +02:00
parent 7d79e6528d
commit 1fac9d9618
3 changed files with 24 additions and 0 deletions

View file

@ -29,4 +29,16 @@ class AdminAccountsSystemTest < ApplicationSystemTestCase
assert_text 'Account has been successfully updated'
assert_text '234'
end
def test_download_accounts_list_as_csv
travel_to Time.zone.parse('2010-07-05 10:30')
get admin_accounts_path(format: :csv)
assert_response :ok
assert_equal 'text/csv; charset=utf-8', response.headers['Content-Type']
assert_equal %(attachment; filename="accounts_#{Time.zone.now.to_formatted_s(:number)}.csv"; filename*=UTF-8''accounts_#{Time.zone.now.to_formatted_s(:number)}.csv),
response.headers['Content-Disposition']
assert_equal file_fixture('accounts.csv').read, response.body
end
end