These are chat archives for rebelidealist/stripe-ruby-mock

7th
May 2014
Antoine
@AntoineInsa
May 07 2014 00:50
But I'm still confused, the account balance is not taken in account (when an invoice is $-300), the next invoice of $400 should be of $100, with starting_balance : 300000 and ending_balance : 0
Gilbert
@gilbert
May 07 2014 02:41
That logic might not be implemented. If you write some test examples, we can get it worked out
Antoine
@AntoineInsa
May 07 2014 17:12
@mindeavor all right! thanks for the support! I'll write my test first with Stripe API test, then check the diff with StripeMock and write some specs! so it will be clearer, and up-to-date!
Mark Richman
@mbrichman
May 07 2014 17:45
Still having issues with my capybara tests. My controller is ultimately calling a class that executes this code:
token = Stripe::Token.create( { customer: credit_card.stripe_customer_id, }, merchant.stripe_access_token )
However this fails when running the spec with NoMethodError: undefined method `[]' for nil:NilClass
I have no idea why. Any help greatly appreciated.
The variables are passing in the right data, I just have no idea why it's failing. Works fine everywhere else.
Antoine
@AntoineInsa
May 07 2014 17:48
@mbrichman have you tried StripeMock.toggle_debug(true)?
Mark Richman
@mbrichman
May 07 2014 17:49
Have not. Will try that.
Antoine
@AntoineInsa
May 07 2014 17:49
You could see the [req] request [res] response
It’s a great help!
Mark Richman
@mbrichman
May 07 2014 17:52
OK, did that and the stuff I'm setting in the test itself looks fine. However, my integration test is invoking a controller action that is calling Stripe presumably outside the scope of stripe_mock? That is what's failing.
Antoine
@AntoineInsa
May 07 2014 17:54
I had this problem as well! Be sure that stripemock start is called at the beginning, and stripemock stop in the end
and be careful with before(:all) and before(:each)! Because you don’t want to stop in the middle of an integration test!
Mark Richman
@mbrichman
May 07 2014 17:55
I have StripeMock.start in a before :each block and the stop in the after block
Antoine
@AntoineInsa
May 07 2014 17:59
I guess StripeMock forgets everything when it stops, so be sure it doesn’t stop while you are testing many steps of a single process
Mark Richman
@mbrichman
May 07 2014 18:03
@AntoineInsa I've tried that as well and it didn't seem to make any difference. Thanks for the suggestions, I appreciate the help.
Antoine
@AntoineInsa
May 07 2014 18:10
no problem, I just started using StripeMock yesterday!
and any hint with the logger? [req] and [res]?
you can activate the logger just around the critical moment, so yon don’t get flooded
StripeMock.toggle_debug(true) / StripeMock.toggle_debug(false)