Know if Request is made. #929
Unanswered
dbenjohockey
asked this question in
Q&A
Replies: 2 comments
-
Perhaps you could use a checking method completely outside what vcr offers? Such as "assert that TheClassThatMakesWebRequests didn't get sent the message :make_request_here". (I'm thinking of the combination "allow(TheClassThatMakesWebRequests).to receive (:make_request_here)" and "expect(TheClassThatMakesWebRequests).not_to have_received(:make_request_here)" - if you are using RSpec. Hope this helps! |
Beta Was this translation helpful? Give feedback.
0 replies
-
@dbenjohockey, I believe webmock is a good fit for your needs. With this gem, you can write assertions in your tests like the one below: assert_not_requested :get, "http://www.something.com" |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am new to VCR (and to github issues) and was wondering the following.
Is it possible to know if the cassette was actually not used? That is, the http request was never made.
Let me explain. from what I understand, VCR is records request and when you use a cassette around some code, it will actually replace what would have been the actual HTTP response by the recording.
What if the block which is supposed to make the request performs some checks beforehand and raise an error if there is a problem.
I would like to test if my code is actually preventing the HTTP request from being made.
Beta Was this translation helpful? Give feedback.
All reactions