diff --git a/app/controllers/admin/budget_investments_controller.rb b/app/controllers/admin/budget_investments_controller.rb
index de2e34d84..12baf20d4 100644
--- a/app/controllers/admin/budget_investments_controller.rb
+++ b/app/controllers/admin/budget_investments_controller.rb
@@ -79,7 +79,8 @@ class Admin::BudgetInvestmentsController < Admin::BaseController
investment.valuators.collect(&:description_or_name).join(', ')
end
heading_name = investment.heading.name
- price = t("admin.budget_investments.index.feasibility.#{investment.feasibility}", price: investment.formatted_price)
+ feasibility_string = "admin.budget_investments.index.feasibility.#{investment.feasibility}"
+ price = t(feasibility_string, price: investment.formatted_price)
valuation_finished = investment.valuation_finished? ? t('shared.yes') : t('shared.no')
csv << [id, title, total_votes, administrator, valuators, heading_name, price, valuation_finished]
end
diff --git a/app/views/admin/budget_investments/_investments.html.erb b/app/views/admin/budget_investments/_investments.html.erb
index f824d1a80..8d2a5191e 100644
--- a/app/views/admin/budget_investments/_investments.html.erb
+++ b/app/views/admin/budget_investments/_investments.html.erb
@@ -58,7 +58,7 @@
<%= investment.valuation_finished? ? t('shared.yes'): t('shared.no') %>
- <%= options = investment_selected_link_options(investment) %>
+ <% options = investment_selected_link_options(investment) %>
<%= link_to toggle_selection_admin_budget_budget_investment_path(@budget, investment, filter: params[:filter], page: params[:page]), method: :patch, remote: true, class: options[:link_class] do %>
<%= options[:text] %>
<% end %>
diff --git a/spec/features/admin/budget_investments_spec.rb b/spec/features/admin/budget_investments_spec.rb
index 55b5af3ce..f67e6d475 100644
--- a/spec/features/admin/budget_investments_spec.rb
+++ b/spec/features/admin/budget_investments_spec.rb
@@ -642,6 +642,19 @@ feature 'Admin budget investments' do
expect(page).to have_content investment2.title
expect(page).to have_content investment1.title
end
+
+ scenario "Downloading CSV file with applied filter" do
+ investment1 = create(:budget_investment, :unfeasible, budget: @budget, title: 'compatible')
+ investment2 = create(:budget_investment, :finished, budget: @budget, title: 'valuation_finished')
+ visit admin_budget_budget_investments_path(@budget, format: :csv, filter: :valuation_finished)
+
+ header = page.response_headers['Content-Disposition']
+ header.should match(/^attachment/)
+ header.should match(/filename="budget_investments.csv"$/)
+
+ expect(page).to have_content investment2.title
+ expect(page).to_not have_content investment1.title
+ end
end
end
|