I'm trying to test my payment process and I'm stuck with the problem of stubbing the subscription, this is the error message I get :
Double "Stripe::Customer" received unexpected message :[] with ("subscription")
This is the relevant part of the code for stubbing subscription :
@subscription = double('Stripe::Subscription')
@subscription.stub(:id) { 1234 }
@customer.stub(:subscription) { [@subscription] }
When I try the payment with the test card and it works, but I want to have an automated test in place in case something changes which could impact the payments
Edit :
per mcfinnigan suggestion I changed he last bit of code to :
@customer.stub(:[]).with(:subscription).and_return { [@subscription] }
And now I get this error :
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.