0
我想测试我的支付过程,我只能坚持磕碰订阅的问题,这是错误消息我得到:成株条纹订阅错误
Double "Stripe::Customer" received unexpected message :[] with ("subscription")
这是相关的部分对于磕碰申购代码:
@subscription = double('Stripe::Subscription')
@subscription.stub(:id) { 1234 }
@customer.stub(:subscription) { [@subscription] }
当我试着使用测试卡支付和它的作品,但我想在一些情况下,改变地方的自动化测试可能影响支付
编辑:
每mcfinnigan建议我改变了他的代码最后一位:
@customer.stub(:[]).with(:subscription).and_return { [@subscription] }
现在我得到这个错误:
Double "Stripe::Customer" received :[] with unexpected arguments
expected: (:subscription)
got: ("subscription")
Please stub a default value first if message might be received with other args as well.
感谢您的回复,请你看看我的更新 – London
@伦敦好吧,所以你收到一个字符串参数,而不是一个符号。使用(“subscription”)将存根更改为'@ customer.stub(:[])。and_return {[@subscription]}' – mcfinnigan