summaryrefslogtreecommitdiff
path: root/spec/support/matchers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-11 12:08:10 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-11 12:08:10 +0000
commitb86f474bf51e20d2db4cf0895d0a8e0894e31c08 (patch)
tree061d2a4c749924f5a35fe6199dd1d8982c4b0b27 /spec/support/matchers
parent6b8040dc25fdc5fe614c3796a147517dd50bc7d8 (diff)
downloadgitlab-ce-b86f474bf51e20d2db4cf0895d0a8e0894e31c08.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/matchers')
-rw-r--r--spec/support/matchers/graphql_matchers.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/support/matchers/graphql_matchers.rb b/spec/support/matchers/graphql_matchers.rb
index ebba5d8a73c..dbf457a9200 100644
--- a/spec/support/matchers/graphql_matchers.rb
+++ b/spec/support/matchers/graphql_matchers.rb
@@ -28,6 +28,19 @@ RSpec::Matchers.define :have_graphql_fields do |*expected|
end
end
+RSpec::Matchers.define :include_graphql_fields do |*expected|
+ expected_field_names = expected.map { |name| GraphqlHelpers.fieldnamerize(name) }
+
+ match do |kls|
+ expect(kls.fields.keys).to include(*expected_field_names)
+ end
+
+ failure_message do |kls|
+ missing = expected_field_names - kls.fields.keys
+ "is missing fields: <#{missing.inspect}>" if missing.any?
+ end
+end
+
RSpec::Matchers.define :have_graphql_field do |field_name, args = {}|
match do |kls|
field = kls.fields[GraphqlHelpers.fieldnamerize(field_name)]