diff --git a/app/views/budgets/results/show.html.erb b/app/views/budgets/results/show.html.erb index 2343e652c..f2b9ae7f8 100644 --- a/app/views/budgets/results/show.html.erb +++ b/app/views/budgets/results/show.html.erb @@ -42,8 +42,10 @@ heading_price: @heading.price, investments: @investments.compatible %> - <%= render 'results_table', results_type: :incompatible, - title: t("budgets.results.incompatibles"), - heading_price: @heading.price, - investments: @investments.incompatible %> + <% if @investments.incompatible.present? %> + <%= render 'results_table', results_type: :incompatible, + title: t("budgets.results.incompatibles"), + heading_price: @heading.price, + investments: @investments.incompatible %> + <% end %> diff --git a/spec/features/budgets/results_spec.rb b/spec/features/budgets/results_spec.rb index cd9cb0912..0e70fdaab 100644 --- a/spec/features/budgets/results_spec.rb +++ b/spec/features/budgets/results_spec.rb @@ -55,4 +55,14 @@ feature 'Results' do expect(page).to have_content "You do not have permission to carry out the action" end + scenario "No incompatible investments", :js do + investment3.incompatible = false + investment3.save + + visit budget_path(budget) + click_link "See results" + + expect(page).not_to have_content "Incompatibles" + end + end