summaryrefslogtreecommitdiff
path: root/spec/support/api/schema_matcher.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/api/schema_matcher.rb')
-rw-r--r--spec/support/api/schema_matcher.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/support/api/schema_matcher.rb b/spec/support/api/schema_matcher.rb
index dff0dfba675..67599f77adb 100644
--- a/spec/support/api/schema_matcher.rb
+++ b/spec/support/api/schema_matcher.rb
@@ -5,7 +5,14 @@ end
RSpec::Matchers.define :match_response_schema do |schema, **options|
match do |response|
- JSON::Validator.validate!(schema_path(schema), response.body, options)
+ @errors = JSON::Validator.fully_validate(schema_path(schema), response.body, options)
+
+ @errors.empty?
+ end
+
+ failure_message do |response|
+ "didn't match the schema defined by #{schema_path(schema)}" \
+ " The validation errors were:\n#{@errors.join("\n")}"
end
end