summaryrefslogtreecommitdiff
path: root/spec/support/matchers/be_valid_json.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/matchers/be_valid_json.rb')
-rw-r--r--spec/support/matchers/be_valid_json.rb16
1 files changed, 1 insertions, 15 deletions
diff --git a/spec/support/matchers/be_valid_json.rb b/spec/support/matchers/be_valid_json.rb
index f46c35c7198..228c1fc986e 100644
--- a/spec/support/matchers/be_valid_json.rb
+++ b/spec/support/matchers/be_valid_json.rb
@@ -1,20 +1,8 @@
# frozen_string_literal: true
RSpec::Matchers.define :be_valid_json do
- def according_to_schema(schema)
- @schema = schema
- self
- end
-
match do |actual|
- data = Gitlab::Json.parse(actual)
-
- if @schema.present?
- @validation_errors = JSON::Validator.fully_validate(@schema, data)
- @validation_errors.empty?
- else
- data.present?
- end
+ Gitlab::Json.parse(actual).present?
rescue JSON::ParserError => e
@error = e
false
@@ -23,8 +11,6 @@ RSpec::Matchers.define :be_valid_json do
def failure_message
if @error
"Parse failed with error: #{@error}"
- elsif @validation_errors.present?
- "Validation failed because #{@validation_errors.join(', and ')}"
else
"Parsing did not return any data"
end