Closed andremleblanc closed 6 years ago
@andremleblanc - Are you sure this is related to VCR? It could just be that your test doesn't provide a mock response.
Not sure, I'll try to reproduce the issue over the weekend and submit a PR if appropriate.
I noticed this when replacing an older third-party gem with this one for communicating to SmartyStreets. The tests would previously raise an error about trying to make an unrecognized http call (if the calls changed from what was recorded in the cassette); my goal would be to make that the behavior again so the error message is more clear.
Created PR #11 to illustrate the behavior and provide a solution for it. You can run the example with ruby test/vcr_test.rb
to see the expected VCR error message.
/Users/andreleblanc/.rvm/gems/ruby-2.4.1/gems/vcr-3.0.3/lib/vcr/request_handler.rb:97:in `on_unhandled_request': (VCR::Errors::UnhandledHTTPRequestError)
================================================================================
An HTTP request has been made that VCR does not know how to handle:
POST https://us-street.api.smartystreets.com/street-address?auth-id&auth-token
There is currently no cassette in use. There are a few ways
you can configure VCR to handle this request:
...
Removing the .to_i
casting in retry_sender.rb will show you the previous error message.
/Users/andreleblanc/Drive/.dev/smartystreets-ruby-sdk/lib/smartystreets_ruby_sdk/retry_sender.rb:17:in `block in send': undefined method `<' for nil:NilClass (NoMethodError)
You probably don't want the extra dev dependencies and failing test, let me know if the solution is okay and I'll clean up the PR.
@andremleblanc - The solution looks good. If you wouldn't mind cleaning up the PR, we'd be delighted to merge it in. Thanks!
Awesome, cleaned it up. Should be good to go! 👍
Thanks! I've merged it in.
Was getting the below error message when running tests.
Line that is breaking:
Looks like response is nil in this case.