Merge pull request #1550 from consul/budgets-unfeasible

Investments reclassified as unfeasible
This commit is contained in:
Juanjo Bazán
2017-05-18 14:37:32 +02:00
committed by GitHub
11 changed files with 236 additions and 47 deletions

View File

@@ -670,25 +670,51 @@ feature 'Budget Investments' do
expect(page).to_not have_link("Vote")
end
scenario "Reclassification" do
user = create(:user, :level_two)
investment = create(:budget_investment, :selected, heading: heading)
heading2 = create(:budget_heading, group: group)
feature "Reclassification" do
ballot = create(:budget_ballot, user: user, budget: budget)
ballot.investments << investment
scenario "Due to heading change" do
user = create(:user, :level_two)
investment = create(:budget_investment, :selected, heading: heading)
heading2 = create(:budget_heading, group: group)
login_as(user)
visit budget_ballot_path(budget)
ballot = create(:budget_ballot, user: user, budget: budget)
ballot.investments << investment
expect(page).to have_content("You have voted one investment")
login_as(user)
visit budget_ballot_path(budget)
investment.heading = heading2
investment.save
expect(page).to have_content("You have voted one investment")
visit budget_ballot_path(budget)
investment.heading = heading2
investment.save
visit budget_ballot_path(budget)
expect(page).to have_content("You have voted 0 investment")
end
scenario "Due to being unfeasible" do
user = create(:user, :level_two)
investment = create(:budget_investment, :selected, heading: heading)
heading2 = create(:budget_heading, group: group)
ballot = create(:budget_ballot, user: user, budget: budget)
ballot.investments << investment
login_as(user)
visit budget_ballot_path(budget)
expect(page).to have_content("You have voted one investment")
investment.feasibility = "unfeasible"
investment.unfeasibility_explanation = "too expensive"
investment.save
visit budget_ballot_path(budget)
expect(page).to have_content("You have voted 0 investment")
end
expect(page).to have_content("You have voted 0 investment")
end
end
end