final details

This commit is contained in:
Raúl Fuentes
2017-11-22 16:32:50 +01:00
parent 4f096a005d
commit b3461b2051
3 changed files with 16 additions and 2 deletions

View File

@@ -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

View File

@@ -58,7 +58,7 @@
<%= investment.valuation_finished? ? t('shared.yes'): t('shared.no') %>
</td>
<td class="small">
<%= 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 %>

View File

@@ -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