From 0875c214ba3a1380eb4e88bc291f1c5660930a0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sat, 4 Sep 2021 18:11:50 +0200 Subject: [PATCH] Make following tab tests easier to understand The `click_link` part did nothing other than scrolling to the element, since in these cases we've got a same-page link and the element it links to is already on the page. Programmers reading the test would expect the link to load the page or change to a different tab and would think the element it links to wasn't there before clicking the link (at least I did). --- spec/system/users_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/system/users_spec.rb b/spec/system/users_spec.rb index b0543f890..5a9607f9c 100644 --- a/spec/system/users_spec.rb +++ b/spec/system/users_spec.rb @@ -438,8 +438,8 @@ describe "Users" do login_as user visit user_path(user, filter: "follows") - click_link "Citizen proposals" + expect(page).to have_link "Citizen proposals", href: "#citizen_proposals" expect(page).to have_content proposal.title end @@ -493,8 +493,8 @@ describe "Users" do budget_investment = create(:budget_investment, author: user, followers: [user]) visit user_path(user, filter: "follows") - click_link "Investments" + expect(page).to have_link "Investments", href: "#investments" expect(page).to have_link budget_investment.title end end