Feature Request - ability to remove stub

53 views
Skip to first unread message

Chris Lorenzo

unread,
Sep 15, 2014, 2:39:56 PM9/15/14
to webmoc...@googlegroups.com
Hi,

I have a rails app with Webmock and VCR. I'd like to have Webmock intercept a call to return a 401 and then allow VCR to handle the next call with the real response. I'd like to have the following code work:

stub_request(:any, %r|.*/rest/user.*|).to_return(:body => '{"errorCode": "SESSION_EXPIRED", "errorMessage": "session has expired"}',
                                                   :status => [401, 'Unauthorized'],
                                                   :headers => { 'error' => 'SESSION_EXPIRED'}).then
  .remove


Webmock is handling the call - and I could do the to_return with the new response, but it would be simpler if I could just remove the stub and then VCR would automatically handle the next request.

Thanks,

Chris

Bartosz Blimke

unread,
Sep 15, 2014, 3:21:01 PM9/15/14
to webmoc...@googlegroups.com
Why don't you tell VCR to return 401?

--

---
You received this message because you are subscribed to the Google Groups "webmock-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webmock-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages