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.
This commit is contained in:
Javi Martín
2024-04-26 00:57:14 +02:00
parent b5d12959a0
commit 5da3bc9969

View File

@@ -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