Commit 691b1b99 authored by Alex Kalderimis's avatar Alex Kalderimis

[GQL] Matchers: explain why arguments are wrong

This adds a failure message to the arguments matcher
parent 41c73d84
......@@ -85,9 +85,16 @@ end
RSpec::Matchers.define :have_graphql_arguments do |*expected|
include GraphqlHelpers
def expected_names
@names ||= Array.wrap(expected).map { |name| GraphqlHelpers.fieldnamerize(name) }
end
match do |field|
argument_names = expected.map { |name| GraphqlHelpers.fieldnamerize(name) }
expect(field.arguments.keys).to contain_exactly(*argument_names)
expect(field.arguments.keys).to contain_exactly(*expected_names)
end
failure_message do |field|
"expected that #{field.name} would have the following fields: #{expected_names.inspect}, but it has #{field.arguments.keys.inspect}."
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment