stripity-stripe
stripity-stripe copied to clipboard
Let Stripe.StripeMock be used by dependents
Hi, thanks for working on this! It's been a huge help to my project. I'm an Elixir newbie so maybe this is already possible, but I think it would be cool if dependents could use Stripe.StripeMock
directly in our own tests. I'm setting up a CI in my project similar to the one here, and I think I'll be wanting to copy the test helpers over so I can write tests in a similar way. Since it requires quite a bit of setup, I think it would be worth exposing Stripe.StripeMock so we can take advantage of the test framework you've built. Thanks!
@alexgleason as another elixir newbie, I agree that would be helpful. However, I've managed to leverage Stripe.StripeMock in my own app's tests by:
- install
stripe-mock
(per the Readme) - copying
stripe_case.ex
andstripe_mock.ex
into mytest/support
directory - copying the contents of
test/test_helper.exs
into my owntest_helper.exs
- adding
use Stripe.StripeCase
to the relevant test cases
As an elixir newbie, I have no idea if there's a better way to do this, but I'm able to run tests against a stripe-mock instance on the local machine, which meets my needs at this point.
I ended up creating a mock HTTP client with my own Stripe fixtures: https://gitlab.com/soapbox-pub/patron/-/blob/develop/test/support/stripe_api_mock.ex
This was pretty tedious, but gave me the flexibility to test exactly what I wanted. I created the fixtures with my Stripe dev account by adding dummy data into the dashboard, and then using cURL to walk through the steps. In the end I think this way made more sense for my project, as I had a handful of specific things I needed to test rather than a need to test all Stripe endpoints.
This issue has been automatically marked as "stale:discard". If this issue still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment.
Closing this issue after a prolonged period of inactivity. If this issue is still relevant, feel free to re-open the issue. Thank you!