debian-mirror-gitlab/spec/support/helpers/features/canonical_link_helpers.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
506 B
Ruby
Raw Permalink Normal View History

2021-01-03 14:25:43 +05:30
# frozen_string_literal: true
# These helpers allow you to manipulate with notes.
#
# Usage:
# describe "..." do
2023-06-20 00:43:36 +05:30
# include Features::CanonicalLinkHelpers
2021-01-03 14:25:43 +05:30
# ...
#
# expect(page).to have_canonical_link(url)
#
2023-06-20 00:43:36 +05:30
module Features
module CanonicalLinkHelpers
def have_canonical_link(url)
have_xpath("//link[@rel=\"canonical\" and @href=\"#{url}\"]", visible: false)
end
2021-01-03 14:25:43 +05:30
2023-06-20 00:43:36 +05:30
def have_any_canonical_links
have_xpath('//link[@rel="canonical"]', visible: false)
2021-01-03 14:25:43 +05:30
end
end
end