2 ms·
The puffing-billy [1] library is awesome, and has changed the way I write integration tests. I also use VCR [2], and now my entire application (both backend and
by nathan_f77 9y ago
The puffing-billy [1] library is awesome, and has changed the way I write integration tests. I also use VCR [2], and now my entire application (both backend and front-end) is wrapped with a proxy that records and replays every request. I can run all my tests once using test Stripe API keys, a test Recaptcha response, or any other external services that I want to test. I don't have to mock anything, which is nice. Then everything is recorded, and I can run all my integration tests offline.
I've also really enjoyed using stripe-ruby-mock when testing specific webhooks, jobs, and controller actions. I don't always aim for 100% test coverage, but I try to write a LOT of tests for any code that deals with billing and subscriptions.
Ooh, I've also been enjoying rswag [4]. It's quite a cool idea - You write rspec tests for your API endpoints, and the tests also serve as a Swagger definition for your API. So when your tests pass, you can use the output to generate documentation or API clients for any language.
[1] https://github.com/oesmith/puffing-billy https://github.com/oesmith/puffing-billy
[2] https://github.com/vcr/vcr https://github.com/vcr/vcr
[3] https://github.com/rebelidealist/stripe-ruby-mock https://github.com/rebelidealist/stripe-ruby-mock
[4] https://github.com/domaindrivendev/rswag https://github.com/domaindrivendev/rswag