small medium large xlarge

Back to: All Forums  Take My Money
Head_shot_pragsmall
21 Apr 2017, 11:48
Noel Rappin (47 posts)

I’m not sure of what the exact issue is without looking at all your code, but the specific problem is the the test double invocations of allow(Payment).to receive(:create).with(attributes) is not getting the same set of attributes that it expects, it looks like it’s getting an extra value for the payment type (which might be the code getting ahead of the tests), and it’s maybe not getting a user id?

So you can tweak the let(:attributes) or alternately, there’s something in the code in the PurchasesCartViaStripe workflow that is not quite right when it creates the purchase.

Later versions of this spec, I think, move away from test doubles, you could also look at those.

Generic-user-small
21 Apr 2017, 20:16
Rails Engineer (11 posts)

I posted this test failure in the Errata section, because it is your source code that is generating the error.

Head_shot_pragsmall
21 Apr 2017, 20:24
Noel Rappin (47 posts)

Okay, not sure how that got through. In my code base, if you change the let statement on line 19 to

let(:attributes) {
    {user_id: user.id, price_cents: 3000,
     reference: a_truthy_value, status: "created",
     payment_method: "stripe"} }

Then the tests pass.

You must be logged in to comment