added test to csv download and style corrections
This commit is contained in:
@@ -68,15 +68,15 @@ class Admin::BudgetInvestmentsController < Admin::BaseController
|
|||||||
id = investment.id.to_s
|
id = investment.id.to_s
|
||||||
title = investment.title
|
title = investment.title
|
||||||
total_votes = investment.total_votes.to_s
|
total_votes = investment.total_votes.to_s
|
||||||
if investment.administrator.present?
|
administrator = if investment.administrator.present?
|
||||||
administrator = investment.administrator.name
|
investment.administrator.name
|
||||||
else
|
else
|
||||||
administrator = t("admin.budget_investments.index.no_admin_assigned")
|
t("admin.budget_investments.index.no_admin_assigned")
|
||||||
end
|
end
|
||||||
if investment.valuators.empty?
|
valuators = if investment.valuators.empty?
|
||||||
valuators = t("admin.budget_investments.index.no_valuators_assigned")
|
t("admin.budget_investments.index.no_valuators_assigned")
|
||||||
else
|
else
|
||||||
valuators = investment.valuators.collect(&:description_or_name).join(', ')
|
investment.valuators.collect(&:description_or_name).join(', ')
|
||||||
end
|
end
|
||||||
heading_name = investment.heading.name
|
heading_name = investment.heading.name
|
||||||
price = t("admin.budget_investments.index.feasibility.#{investment.feasibility}", price: investment.formatted_price)
|
price = t("admin.budget_investments.index.feasibility.#{investment.feasibility}", price: investment.formatted_price)
|
||||||
|
|||||||
@@ -625,7 +625,23 @@ feature 'Admin budget investments' do
|
|||||||
expect(page).not_to have_link('Selected')
|
expect(page).not_to have_link('Selected')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "Selecting csv" do
|
||||||
|
|
||||||
|
scenario "Downloading CSV file" do
|
||||||
|
create(:budget_investment, :unfeasible, budget: @budget)
|
||||||
|
create(:budget_investment, :feasible, budget: @budget)
|
||||||
|
|
||||||
|
visit admin_budget_budget_investments_path(@budget, format: :csv)
|
||||||
|
|
||||||
|
header = page.response_headers['Content-Disposition']
|
||||||
|
header.should match /^attachment/
|
||||||
|
header.should match /filename="budget_investments.csv"$/
|
||||||
|
|
||||||
|
expect(page).to have_content "Budget Investment 1 title"
|
||||||
|
expect(page).to have_content "Budget Investment 2 title"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user