1# frozen_string_literal: true
2
3module QA
4  module Support
5    module Matchers
6      module HaveMatcher
7        PREDICATE_TARGETS = %w[
8          element
9          file_content
10          assignee
11          child_pipeline
12          content
13          design
14          file
15          issue
16          job
17          package
18          pipeline
19          related_issue_item
20          snippet_description
21          tag
22          label
23        ].each do |predicate|
24          RSpec::Matchers.define "have_#{predicate}" do |*args, **kwargs|
25            match do |page_object|
26              page_object.public_send("has_#{predicate}?", *args, **kwargs)
27            end
28
29            match_when_negated do |page_object|
30              page_object.public_send("has_no_#{predicate}?", *args, **kwargs)
31            end
32          end
33        end
34      end
35    end
36  end
37end
38