Skip to content

Conversation

ethanabrooks
Copy link

Previously, the first rspec test was failing because the matcher.rb was only rescuing JSON::ParseErrors but not MultiJson::ParseErrors. For whatever reason, the empty string raised the latter, not the former, error.

With this minor fix, all tests are green.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch!

What do you think about combining the errors on a single line:

rescue JSON::ParserError, MultiJson::ParseError
  raise InvalidSchemaError
end

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sold! Let's do it.

@seanpdoyle
Copy link
Collaborator

On further inspection, what is the source of the MultiJson::ParseError?

What happens when the multi_json isn't included as a dependency?

@ethanabrooks
Copy link
Author

For some reason, it tries to parse the empty string JSON schema in the first rspec test with MultiJson, not the regular JSON validator.

I looked up the docs for MultiJson, and it seems to be kind of a catch-all JSON coder. Not sure how Ruby decides between multijson and the regular JSON validator.

On Oct 6, 2015, at 9:10 PM, Sean Doyle [email protected] wrote:

On further inspection, what is the source of the MultiJson::ParseError?

What happens when the multi_json https://github.com/intridea/multi_json isn't included?


Reply to this email directly or view it on GitHub #20 (comment).

@ethanabrooks
Copy link
Author

A small follow up:
I placed a break point just above the call to JSON::Validator and confirmed that, for some reason, when we call that method, ruby invokes the MultiJson library. The documentation on JSON is pretty sparse, but I will dig a little further to figure out why.

On Oct 6, 2015, at 9:13 PM, Ethan Brooks [email protected] wrote:

For some reason, it tries to parse the empty string JSON schema in the first rspec test with MultiJson, not the regular JSON validator.

I looked up the docs for MultiJson, and it seems to be kind of a catch-all JSON coder. Not sure how Ruby decides between multijson and the regular JSON validator.

On Oct 6, 2015, at 9:10 PM, Sean Doyle <[email protected] mailto:[email protected]> wrote:

On further inspection, what is the source of the MultiJson::ParseError?

What happens when the multi_json https://github.com/intridea/multi_json isn't included?


Reply to this email directly or view it on GitHub #20 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants