From 0b287e4a78bd97f22011e8ee526f3f722e7aa2f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sat, 12 Jun 2021 19:20:33 +0200 Subject: [PATCH] Fix test checking same group investment support We meant to check that the link to support a different investment didn't have an alert dialog. However, we were testing by trying to support the same investment twice, and here there was no link at all, so the assertion "there's no link with a dialog" always passed even when the application didn't behave properly. Now we check there's a link there, and that link doesn't have an associated alert dialog. --- spec/system/budgets/investments_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/system/budgets/investments_spec.rb b/spec/system/budgets/investments_spec.rb index aedf5893c..af1261847 100644 --- a/spec/system/budgets/investments_spec.rb +++ b/spec/system/budgets/investments_spec.rb @@ -1122,12 +1122,14 @@ describe "Budget Investments" do salamanca = create(:budget_heading, group: group) create(:budget_investment, title: "In Carabanchel", heading: carabanchel, voters: [author]) + create(:budget_investment, title: "Unsupported in Carabanchel", heading: carabanchel) create(:budget_investment, title: "In Salamanca", heading: salamanca) login_as(author) visit budget_investments_path(budget, heading_id: carabanchel.id) - within(".budget-investment", text: "In Carabanchel") do + within(".budget-investment", text: "Unsupported in Carabanchel") do + expect(page).to have_link "Support" expect(page).not_to have_css(".in-favor a[data-confirm]") end end