Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'qa/spec/support/matchers/have_matcher.rb')
-rw-r--r--qa/spec/support/matchers/have_matcher.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/qa/spec/support/matchers/have_matcher.rb b/qa/spec/support/matchers/have_matcher.rb
new file mode 100644
index 00000000000..43ae27f8796
--- /dev/null
+++ b/qa/spec/support/matchers/have_matcher.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+module Matchers
+ PREDICATE_TARGETS = %w[
+ element
+ file_content
+ assignee
+ child_pipeline
+ content
+ design
+ file
+ issue
+ job
+ package
+ pipeline
+ related_issue_item
+ snippet_description
+ ].each do |predicate|
+ RSpec::Matchers.define "have_#{predicate}" do |*args, **kwargs|
+ match do |page_object|
+ page_object.public_send("has_#{predicate}?", *args, **kwargs) # rubocop:disable GitlabSecurity/PublicSend
+ end
+
+ match_when_negated do |page_object|
+ page_object.public_send("has_no_#{predicate}?", *args, **kwargs) # rubocop:disable GitlabSecurity/PublicSend
+ end
+ end
+ end
+end