mirror of
https://github.com/internetee/registry.git
synced 2025-07-01 16:53:37 +02:00
parent
6489106a4a
commit
4232301484
2 changed files with 5 additions and 1 deletions
|
@ -52,7 +52,8 @@ class Registrar
|
||||||
end
|
end
|
||||||
|
|
||||||
csv = Registrar::DomainListCSVPresenter.new(domains: domain_presenters, view: view_context).to_s
|
csv = Registrar::DomainListCSVPresenter.new(domains: domain_presenters, view: view_context).to_s
|
||||||
send_data(csv)
|
filename = "Domains_#{l(Time.zone.now, format: :filename)}.csv"
|
||||||
|
send_data(csv, filename: filename)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,6 +6,8 @@ class RegistrarDomainsTest < ActionDispatch::IntegrationTest
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_downloads_domain_list_as_csv
|
def test_downloads_domain_list_as_csv
|
||||||
|
travel_to Time.zone.parse('2010-07-05 10:30')
|
||||||
|
|
||||||
expected_csv = <<-CSV.strip_heredoc
|
expected_csv = <<-CSV.strip_heredoc
|
||||||
Domain,Transfer code,Registrant name,Registrant code,Date of expiry
|
Domain,Transfer code,Registrant name,Registrant code,Date of expiry
|
||||||
library.test,45118f5,Acme Ltd,acme-ltd-001,2010-07-05
|
library.test,45118f5,Acme Ltd,acme-ltd-001,2010-07-05
|
||||||
|
@ -15,6 +17,7 @@ class RegistrarDomainsTest < ActionDispatch::IntegrationTest
|
||||||
|
|
||||||
visit registrar_domains_url
|
visit registrar_domains_url
|
||||||
click_button 'Download as CSV'
|
click_button 'Download as CSV'
|
||||||
|
assert_equal 'attachment; filename="Domains_2010-07-05_10.30.csv"', response_headers['Content-Disposition']
|
||||||
assert_equal expected_csv, page.body
|
assert_equal expected_csv, page.body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue