Show unfeasible budget investment messages only when valuation finished

This commit is contained in:
decabeza
2019-03-06 10:07:11 +01:00
parent cce852d303
commit 55a2bcb559
2 changed files with 20 additions and 5 deletions

View File

@@ -146,7 +146,7 @@
<% end %> <% end %>
<% end %> <% end %>
<% if investment.unfeasible? %> <% if investment.unfeasible? && investment.valuation_finished? %>
<div class="callout warning"> <div class="callout warning">
<%= t("budgets.investments.show.project_unfeasible_html") %> <%= t("budgets.investments.show.project_unfeasible_html") %>
</div> </div>

View File

@@ -1097,23 +1097,38 @@ feature 'Budget Investments' do
end end
scenario "Show (unfeasible budget investment)" do scenario "Show (unfeasible budget investment) only when valuation finished" do
user = create(:user) user = create(:user)
login_as(user) login_as(user)
investment = create(:budget_investment, investment = create(:budget_investment,
:unfeasible,
budget: budget,
group: group,
heading: heading,
unfeasibility_explanation: "Local government is not competent in this")
investment_2 = create(:budget_investment,
:unfeasible, :unfeasible,
:finished, :finished,
budget: budget, budget: budget,
group: group, group: group,
heading: heading, heading: heading,
unfeasibility_explanation: 'Local government is not competent in this matter') unfeasibility_explanation: "The unfeasible explanation")
visit budget_investment_path(budget_id: budget.id, id: investment.id) visit budget_investment_path(budget_id: budget.id, id: investment.id)
expect(page).not_to have_content("Unfeasibility explanation")
expect(page).not_to have_content("Local government is not competent in this")
expect(page).not_to have_content("This investment project has been marked as not feasible "\
"and will not go to balloting phase")
visit budget_investment_path(budget_id: budget.id, id: investment_2.id)
expect(page).to have_content("Unfeasibility explanation") expect(page).to have_content("Unfeasibility explanation")
expect(page).to have_content("Local government is not competent in this matter") expect(page).to have_content("The unfeasible explanation")
expect(page).to have_content("This investment project has been marked as not feasible and will not go to balloting phase") expect(page).to have_content("This investment project has been marked as not feasible "\
"and will not go to balloting phase")
end end
scenario "Show (selected budget investment)" do scenario "Show (selected budget investment)" do