I've written this code to test what happens once a Stripe card token has been passed through to the server. This code does not do any browser testing (because JS-friendly headless testing is painful at best, and impossible if you want VCR in the mix). VCR is being used here to capture interactions with a test Stripe account, to ensure the tests are fast on future runs. That said, it's structured so that nothing is expected to be present in the Stripe account. If you delete all the stored VCR cassettes, the specs will safely re-record them.
Instead of using
VCR.use_cassette directly, instead you use
stripe_cassette in your specs, passing in the current spec example object. This will automatically generate a cassette name based on the spec's file name and the example's description (limitations of this are noted in the code comments). Within the cassette's recording block, Stripe data is cleared out before yielding back to the spec, with a context object. The context object provides access to helper methods