diff --git a/app/views/donation_sites/index.html.erb b/app/views/donation_sites/index.html.erb index 099ef4935c..7301fe4dc2 100644 --- a/app/views/donation_sites/index.html.erb +++ b/app/views/donation_sites/index.html.erb @@ -45,7 +45,7 @@ <%= clear_filter_button %> <%= modal_button_to("#csvImportModal", {icon: "upload", text: "Import Donation Sites", size: "md"}) if @donation_sites.empty? %> - <%= download_button_to(donation_sites_path(format: :csv, filters: filter_params), {text: "Export Donation Sites", size: "md"}) if @donation_sites.any? %> + <%= download_button_to(donation_sites_path(format: :csv, include_inactive_donation_sites: @include_inactive_donation_sites, filters: filter_params), {text: "Export Donation Sites", size: "md"}) if @donation_sites.any? %> <%= new_button_to new_donation_site_path, {text: "New Donation Site"} %> diff --git a/spec/system/donation_site_system_spec.rb b/spec/system/donation_site_system_spec.rb index 767bf8d64a..b73dbdeb07 100644 --- a/spec/system/donation_site_system_spec.rb +++ b/spec/system/donation_site_system_spec.rb @@ -20,6 +20,22 @@ expect(page.find(:xpath, "//table/tbody/tr[1]/td[1]")).to have_content(@first.name) expect(page.find(:xpath, "//table/tbody/tr[3]/td[1]")).to have_content(@third.name) end + + context "when exporting a csv with include inactive donation sites selected" do + it "includes active and inactive donation sites" do + create(:donation_site, name: "Active Donation Site") + create(:donation_site, name: "Inactive Donation Site", active: false) + visit subject + check "Also include inactive donation sites" + click_on "Filter" + click_on "Export Donation Sites" + wait_for_download + @csv_content = File.read(download) + + expect(@csv_content).to have_content("Active Donation Site") + expect(@csv_content).to have_content("Inactive Donation Site") + end + end end context "When creating a new donation site" do