Do not display voting button for unselected investments

This commit is contained in:
rgarcia
2017-05-14 18:15:04 +02:00
parent 207b300d3e
commit 9a75067d73
2 changed files with 19 additions and 1 deletions

View File

@@ -216,7 +216,7 @@ class Budget
end end
def should_show_ballots? def should_show_ballots?
budget.balloting? budget.balloting? && selected?
end end
def should_show_price? def should_show_price?

View File

@@ -652,6 +652,24 @@ feature 'Budget Investments' do
expect(page).to have_current_path(expected_path) expect(page).to have_current_path(expected_path)
end end
scenario "Do not display vote button for unselected investments in index" do
investment = create(:budget_investment, :unselected, heading: heading)
visit budget_investments_path(budget_id: budget.id, heading_id: heading.id, filter: "unselected")
expect(page).to have_content investment.title
expect(page).to_not have_link("Vote")
end
scenario "Do not display vote button for unselected investments in show" do
investment = create(:budget_investment, :unselected, heading: heading)
visit budget_investment_path(budget, investment)
expect(page).to have_content investment.title
expect(page).to_not have_link("Vote")
end
scenario "Reclassification" do scenario "Reclassification" do
user = create(:user, :level_two) user = create(:user, :level_two)
investment = create(:budget_investment, :selected, heading: heading) investment = create(:budget_investment, :selected, heading: heading)