diff --git a/app/views/budgets/investments/_investment_show.html.erb b/app/views/budgets/investments/_investment_show.html.erb
index 49543417d..29620a726 100644
--- a/app/views/budgets/investments/_investment_show.html.erb
+++ b/app/views/budgets/investments/_investment_show.html.erb
@@ -150,7 +150,7 @@
<%= t("budgets.investments.show.project_unfeasible_html") %>
- <% elsif investment.winner? %>
+ <% elsif investment.winner? && @budget.finished? %>
<%= t("budgets.investments.show.project_winner") %>
diff --git a/spec/features/budgets/investments_spec.rb b/spec/features/budgets/investments_spec.rb
index 533b8d543..8bdca3d7c 100644
--- a/spec/features/budgets/investments_spec.rb
+++ b/spec/features/budgets/investments_spec.rb
@@ -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