Open alec-c4 opened 1 day ago
I think that mocking the API from within your tests is likely the best way to handle this.
You can actually see how this is done within this repo. There is an Rspec helper registered here that stubs out network requests using Webmock and returns the contents of a fixture file. The not_pwned_validator_spec
actually shows this in use in specs with an ActiveRecord model.
Let me know if that helps at all.
Hi! I’d like to ask you to share your thoughts on how to use gem in testing. Currently, I’ve disabled the validator in the model to speed up tests, but I’m not sure if that’s the best approach. Perhaps we should consider mocking the HIBP service instead?