Global stubs are given precedence over request stubs #171

jpignata opened this Issue Mar 30, 2012 · 4 comments


None yet
3 participants

Concerning the change made in a950ab8 where the global stubs are given precedence over any stubs made in the test example:

We were relying on the previous behavior in order to add a catch-all stub that mops up any HTTP requests made and not specifically under test. It feels like this is the more common use case for a global stub rather than using it as a filter to be ran before any stubs are matched. Is there any interest in a pull request that adds a hook to run a block prior to stub matching for the kind of setup that VCR does referenced in the commit message?


bblimke commented Apr 2, 2012

All global stubs code was created for easier integration in VCR. It's not documented and not really supported,
the same way as webmock api.

I'm happy to see it's used not only by VCR though :)

@myronmarston any ideas?


myronmarston commented Apr 2, 2012 would be fairly complicated refactoring in VCR to have it work with a before_request hook and the global stub hook itself, and I think there would be somethings that I may not be able to get to work right

Instead, what do you think about having globally_stub_request accept an option that determines if it goes before individual subs or after individual stubs?

jpignata commented Apr 2, 2012

That works for me. We can submit a patch for that.


bblimke commented May 12, 2012

This solution sounds reasonable. Please send a pull request if you still need it.

bblimke closed this May 12, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment