-
Notifications
You must be signed in to change notification settings - Fork 104
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
EXTREMELY hard to test with rspec #25
Comments
Take a look at this example application: https://github.com/invisiblefunnel/test-hooks. If you find it helpful I'll add it to the README. The main thing is to stub out the HTTP request which retrieves the event from Stripe. Then you can return the JSON collected from RequestBin as though it was returned directly from Stripe. |
So if I am reading this correctly, you are taking advantage of the security check that is already in Stripe Event and basically telling the spec that when it makes the request to api.stripe.com, intercept them and supply the JSON in the fixture, is that correct? Thanks! Joshua Lippiner Is this one of 20 or more emails in your inbox? You need a doorman for your inbox!! (Which I created :)) Check out Taper by Clicking Here (http://www.kickstarter.com/projects/1369431496/taper-the-end-of-email-overload) Now. Thanks! On Friday, November 15, 2013 at 3:51 PM, Danny Whalen wrote:
|
Exactly. This is how I recommend testing Stripe webhooks. Thanks for your question; I've wanted to build an example app for a while. |
Did you just create that app? I spent ALL DAY looking for something like that. Im going to test it right now but THANK YOU. Joshua Lippiner Is this one of 20 or more emails in your inbox? You need a doorman for your inbox!! (Which I created :)) Check out Taper by Clicking Here (http://www.kickstarter.com/projects/1369431496/taper-the-end-of-email-overload) Now. Thanks! On Friday, November 15, 2013 at 4:35 PM, Danny Whalen wrote:
|
You're welcome. If you have any feedback on the example app please let me know and I'll incorporate it when I add a testing section to the StripeEvent readme. |
YES!! Ok - I FINALLY got the tests to work. It was fine but here were the gotchas that I found:
I might recommend changing the method to something like this as it did cause some confusion for me:
but other than that it was GREAT! Thanks! |
I feel like I MUST be missing something. This should be MUCH easier but Ive spent hours on this.
Using the dashboard (not test webhooks as the README states) I created a bunch of actions. I used RequestBin to capture the raw response and saved them locally to fixture files.
I then created a spec to post the data to the server to test the hooks. It simply doesnt work. I either get 500 errors due to Hash Indifference or the events are processed as strings.
Here is are some examples:
which returns an Unauthorized. I've also tried doing different variations of these:
I simply need a way to create specs for every possible hook I have wired up for testing. Ideally I dont need to actually perform every one of those actions on Stripe to get the response.
How can I stub and test the various event types without going crazy?
The text was updated successfully, but these errors were encountered: