Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to set clear_cache option #225

Closed
tegon opened this issue Feb 3, 2015 · 1 comment · Fixed by #235
Closed

Unable to set clear_cache option #225

tegon opened this issue Feb 3, 2015 · 1 comment · Fixed by #235

Comments

@tegon
Copy link

tegon commented Feb 3, 2015

Hey guys,
I'm using the gem in my test environment, to validate my api responses, like this:

JSON::Validator.validate!("#{ Dir.pwd }/spec/support/api/schemas/product.json", JSON.parse(last_response.body), { strict: true, validate_schema: true })

I wanna clear the cache of schemas after each test, so i tried this way

JSON::Validator.validate!(schema_path, response.body, { strict: true, validate_schema: true, clear_cache: true })

but didn't work

Looking into source code, i was able to make this work by adding this line

@validation_options[:clear_cache] = true if @options[:clear_cache] == true

below this line: https://github.com/ruby-json-schema/json-schema/blob/master/lib/json-schema/validator.rb#L48

Please let me know if i'm trying to do this wrong.

Thanks.

@SauloSilva
Copy link

@tegon +1
Am also with the same mistake.
Think this you commented would solve the problem.

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 a pull request may close this issue.

2 participants