Fix where text/csv exports weren't always uploaded as attachment

This commit is contained in:
Eric Schultz 2018-08-08 12:23:28 -05:00
parent 292d31132f
commit 26704b1d94
4 changed files with 4 additions and 2 deletions

View file

@ -53,7 +53,7 @@ module ExportPayments
file_date = Time.now.getutc().strftime('%m-%d-%Y--%H-%M-%S')
filename = "tmp/csv-exports/payments-#{file_date}.csv"
url = CHUNKED_UPLOADER.upload(filename, QueryPayments.for_export_enumerable(npo_id, params, 30000).map{|i| i.to_csv}, :content_type => 'text/csv')
url = CHUNKED_UPLOADER.upload(filename, QueryPayments.for_export_enumerable(npo_id, params, 30000).map{|i| i.to_csv}, :content_type => 'text/csv', content_disposition: 'attachment')
export.url = url
export.status = :completed
export.ended = Time.now

View file

@ -53,7 +53,7 @@ module ExportRecurringDonations
file_date = Time.now.getutc().strftime('%m-%d-%Y--%H-%M-%S')
filename = "tmp/csv-exports/recurring_donations-#{file_date}.csv"
url = CHUNKED_UPLOADER.upload(filename, QueryRecurringDonations.for_export_enumerable(npo_id, params, 30000).map{|i| i.to_csv}, :content_type => 'text/csv')
url = CHUNKED_UPLOADER.upload(filename, QueryRecurringDonations.for_export_enumerable(npo_id, params, 30000).map{|i| i.to_csv}, :content_type => 'text/csv', content_disposition: 'attachment')
export.url = url
export.status = :completed
export.ended = Time.now

View file

@ -192,6 +192,7 @@ describe ExportPayments do
expect(csv[0]).to eq MockHelpers.payment_export_headers
expect(TestChunkedUploader.options[:content_type]).to eq 'text/csv'
expect(TestChunkedUploader.options[:content_disposition]).to eq 'attachment'
expect(user).to have_received_email(subject: "Your payment export is available!")
end
end

View file

@ -194,6 +194,7 @@ describe ExportRecurringDonations do
expect(csv[0]).to eq MockHelpers.recurring_donation_export_headers
expect(TestChunkedUploader.options[:content_type]).to eq 'text/csv'
expect(TestChunkedUploader.options[:content_disposition]).to eq 'attachment'
expect(@user).to have_received_email(subject: "Your recurring donations export is available!")
end
end