Browse Source

Post to organisation send csv email path

pull/2237/head
Kat 2 years ago
parent
commit
e8c7f81daf
  1. 2
      app/controllers/organisations_controller.rb
  2. 13
      spec/features/organisation_spec.rb

2
app/controllers/organisations_controller.rb

@ -33,7 +33,7 @@ class OrganisationsController < ApplicationController
organisation_schemes = Scheme.where(owning_organisation: [@organisation] + @organisation.parent_organisations) organisation_schemes = Scheme.where(owning_organisation: [@organisation] + @organisation.parent_organisations)
unpaginated_filtered_schemes = filter_manager.filtered_schemes(organisation_schemes, search_term, session_filters) unpaginated_filtered_schemes = filter_manager.filtered_schemes(organisation_schemes, search_term, session_filters)
render "schemes/download_csv", locals: { search_term:, post_path: email_csv_schemes_path, download_type: params[:download_type], schemes: unpaginated_filtered_schemes } render "schemes/download_csv", locals: { search_term:, post_path: schemes_email_csv_organisation_path, download_type: params[:download_type], schemes: unpaginated_filtered_schemes }
end end
def email_schemes_csv def email_schemes_csv

13
spec/features/organisation_spec.rb

@ -327,6 +327,19 @@ RSpec.describe "User Features" do
end end
end end
context "when viewing schemes for specific organisation" do
before do
create(:scheme, owning_organisation: organisation)
visit("/organisations/#{org_id}/schemes")
end
it "allows downloading schemes csv for the specific org" do
click_link("Download schemes (CSV)")
click_button("Send email")
expect(page).to have_current_path("/organisations/#{org_id}/schemes/csv-confirmation")
end
end
context "and the organisation does not hold housing stock" do context "and the organisation does not hold housing stock" do
before do before do
organisation.update!(holds_own_stock: false) organisation.update!(holds_own_stock: false)

Loading…
Cancel
Save