summaryrefslogtreecommitdiff
path: root/spec/support/helpers/features/canonical_link_helpers.rb
blob: da3a28f1cb20673320e21368ba77400b8e7ce5e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

# These helpers allow you to manipulate with notes.
#
# Usage:
#   describe "..." do
#     include Spec::Support::Helpers::Features::CanonicalLinkHelpers
#     ...
#
#     expect(page).to have_canonical_link(url)
#
module Spec
  module Support
    module Helpers
      module Features
        module CanonicalLinkHelpers
          def have_canonical_link(url)
            have_xpath("//link[@rel=\"canonical\" and @href=\"#{url}\"]", visible: false)
          end

          def have_any_canonical_links
            have_xpath('//link[@rel="canonical"]', visible: false)
          end
        end
      end
    end
  end
end