Show project winner label only if budget is finished

This commit is contained in:
decabeza
2019-02-04 15:03:14 +01:00
parent 556a72347e
commit 025bcedce9
2 changed files with 9 additions and 2 deletions

View File

@@ -150,7 +150,7 @@
<div class="callout warning">
<%= t("budgets.investments.show.project_unfeasible_html") %>
</div>
<% elsif investment.winner? %>
<% elsif investment.winner? && @budget.finished? %>
<div class="callout success">
<strong><%= t("budgets.investments.show.project_winner") %></strong>
</div>

View File

@@ -1073,7 +1073,8 @@ feature 'Budget Investments' do
expect(page).to have_content("This investment project has been selected for balloting phase")
end
scenario "Show (winner budget investment)" do
scenario "Show (winner budget investment) only if budget is finished" do
budget.update(phase: "balloting")
user = create(:user)
login_as(user)
@@ -1088,6 +1089,12 @@ feature 'Budget Investments' do
visit budget_investment_path(budget_id: budget.id, id: investment.id)
expect(page).not_to have_content("Winning investment project")
budget.update(phase: "finished")
visit budget_investment_path(budget_id: budget.id, id: investment.id)
expect(page).to have_content("Winning investment project")
end