From 4b388cc6714992670efccd72c2e9edba27ff3ced Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Mon, 25 Jan 2021 15:42:42 +0500 Subject: [PATCH] Add test for admin csv download --- test/system/admin_area/domains/csv_test.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/system/admin_area/domains/csv_test.rb diff --git a/test/system/admin_area/domains/csv_test.rb b/test/system/admin_area/domains/csv_test.rb new file mode 100644 index 000000000..0333725dc --- /dev/null +++ b/test/system/admin_area/domains/csv_test.rb @@ -0,0 +1,18 @@ +require 'application_system_test_case' + +class AdminAreaCsvTest < ApplicationSystemTestCase + setup do + sign_in users(:admin) + end + + def test_downloads_domain_list_as_csv + search_params = {"valid_to_lteq"=>nil} + expected_csv = Domain.includes(:registrar, :registrant).search(search_params).result.to_csv + + travel_to Time.zone.parse('2010-07-05 10:30') + visit admin_domains_url + click_link(class: 'glyphicon glyphicon-list-alt') + assert_equal "attachment; filename=\"domains.csv\"; filename*=UTF-8''domains.csv", response_headers['Content-Disposition'] + assert_equal expected_csv, page.body + end +end