New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow stripe_account
to be set globally:
#412
Allow stripe_account
to be set globally:
#412
Conversation
Thanks! So my only fear here is that other global fields like Can I ask you what your use case is for you is here? |
Thanks for quick answer Moving to managed account would mean that we need to pass the Instead we would like to set the |
has_entry(:headers, has_entry(:stripe_account, 'acct_1234')), | ||
any_parameters, | ||
any_parameters | ||
).returns(make_response(response)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Edouard-chin, so execute_request_with_rescues
is at least to some degree what I'd consider a private-level method, and it would be nice to avoid referencing it in tests if possible.
test_helper
defines a standardized way of mocking out HTTP requests; would you mind changing this check over to use that? Here is an example of a mock that would be very close to the one that you want to build.
@Edouard-chin Cool! I'm okay with bringing this in given that we currently don't give you a better way of doing this (we'll continue to work on that part of it). I left one piece of feedback above. Would you mind taking a look at it, and then we can get this shipped. Thanks! |
Hey @brandur , awesome this is going to simplify our life greatly! I modified the test as you advised to mock the response with the standardized way. However and maybe I was doing this wrong but the test was focusing on checking what headers were passed to the request. This is no more the case as the I'm fine if this is ok to you, I will have to rename the test and squash 😄 |
@@ -33,4 +33,20 @@ class StripeTest < Test::Unit::TestCase | |||
Stripe.max_network_retries = old | |||
end | |||
end | |||
|
|||
should "pass the stripe-account in the header" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also rename this one to "makes requests with the Stripe-Account header"?
@Edouard-chin Doh! Okay, sorry that was my mistake. We definitely want to test for the header though. Could you revert the last change and keep it the same except see if you can stub on the Thanks! And sorry about the churn. (And yes, please squash this all up if you can.) |
- When performing requests on the behalf of a managed account, `stripe_account` option must be passed everytime, this can become redundant - Allowing to set the `stripe_account` globally makes thing easier for wrapping every request in a single method, the same way as it is for defining the `api_key` globally
c54712d
to
75f366a
Compare
@brandur No need to apologize thanks for your precious help ! All your comments should now be addressed, squashed commits and 💚 travis. |
Thank-you :) Released as 1.41.0. |
stripe_account
option must be passed everytime, this can become redundantstripe_account
globally makes thing easier for wrapping every request in a single method, the same way as it is when defining theapi_key
globally@matthelm