#ed-stripe-mock
1 messages · Page 1 of 1 (latest)
You should be able to use Stripe Mock for that https://github.com/stripe/stripe-mock
ed-stripe-mock
Thanks; I understand that stripe-mock is a server written in Go, but ... I don't know how exactly to use it in my ruby spec tests. Do I need to configure the Stripe ruby gem in my Ruby app to connect to port 4999 (somehow)?
correct, POSTs or GET requests like this https://github.com/stripe/stripe-mock#sample-request
Thanks. What would help me get going fastest would be a simple example app that tests stripe. I see StripeMock is in stripe-ruby/test/stripe_mock.rb , but I'm not sure how to use it...
Maybe I call StripeMock.start ..?
those are for stripe-ruby to run its own tests
you use the instructions here https://github.com/stripe/stripe-mock#usage
Thanks, but ... why do the usage instructions for stripe mock make no mention of how to configure stripe.rb to actually use the mock? Seems like a pretty common thing to do. I can fumble around and come up with something, but ... it seems like what I'm doing has got to be one of the most common ways to use stripe-mock. I think I need something like:
setup do
Stripe.api_key = "sk_test_123"
Stripe.api_base = "http://localhost:#{MOCK_PORT}"
stub_connect
end
Stripe.api_base being the thing that is not mentioned in stripe-mock instructions anywhere, AFAICT...
That snippet is from stripe-ruby/test/test_helper.rb .
Yes, it's not in stripe-mock. But shouldn't this be in stripe-mock's README so that those who use stripe-mock can discover how to configure stripe.rb (or stripe.whatever) to use the alternate hostname and port?
Or am I simply looking in the wrong place and there is some other documentation that explains this?
👋 hopping in here since hmunoz has to head out