From 5da3bc996959fea274b8a9b39e65dc94c4c4c584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 26 Apr 2024 00:57:14 +0200 Subject: [PATCH] Fix test checking notifications without a link The test was supposed to be testing notifications without a link, but it was adding a link. It was only passing because the expectations was checking whether there was a link whose text was a URL, but what we want to check here is whether the URL is present in the `href` attribute. We're about to delete the page showing public stats and, since this link was using the `/stats` path, we're fixing it. --- spec/system/notifications_spec.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spec/system/notifications_spec.rb b/spec/system/notifications_spec.rb index 379aaed3a..e0139659e 100644 --- a/spec/system/notifications_spec.rb +++ b/spec/system/notifications_spec.rb @@ -175,12 +175,13 @@ describe "Notifications" do end scenario "Without a link" do - admin_notification.update!(link: "/stats") + admin_notification.update!(link: nil) visit notifications_path - expect(page).to have_content("Notification title") - expect(page).to have_content("Notification body") - expect(page).not_to have_link(notification_path(notification), visible: :all) + + expect(page).to have_content "Notification title" + expect(page).to have_content "Notification body" + expect(page).not_to have_link href: notification_path(notification), visible: :all end end