Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/views/donation_sites/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<%= clear_filter_button %>
<span class="float-right">
<%= 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"} %>
</span>
</div>
Expand Down
16 changes: 16 additions & 0 deletions spec/system/donation_site_system_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down