Permalink
Browse files

Include schema in error output for invalid schemas.

  • Loading branch information...
myronmarston committed Apr 30, 2013
1 parent 3c85b18 commit 03c90c570668eeb077e546ee65e4fac4a3472e97
Showing with 2 additions and 2 deletions.
  1. +1 −1 lib/interpol/endpoint.rb
  2. +1 −1 spec/unit/interpol/endpoint_spec.rb
View
@@ -214,7 +214,7 @@ def endpoint_name
def validate_data!(data)
errors = ::JSON::Validator.fully_validate_schema(schema)
- raise ValidationError.new(errors, nil, description) if errors.any?
+ raise ValidationError.new(errors, schema, description) if errors.any?
errors = ::JSON::Validator.fully_validate(schema, data)
raise ValidationError.new(errors, data, description) if errors.any?
end
@@ -331,7 +331,7 @@ def new_with(hash)
schema['properties']['foo']['minItems'] = 'foo'
expect {
subject.validate_data!('foo' => 17)
- }.to raise_error(ValidationError)
+ }.to raise_error(ValidationError, /Data:\s+{"type"=>"object"/m)
end
it 'rejects unrecognized data types' do

0 comments on commit 03c90c5

Please sign in to comment.