From ee92f46bd5fc8eba8370988284d3150ab5bd238b Mon Sep 17 00:00:00 2001 From: Rob Harrington Date: Fri, 14 Jul 2017 18:21:32 +1000 Subject: [PATCH] Fix stripe request spec by providing en enterprise_id The enterprise_id is used to lookup a StripeAccount which is provided to the Spree::Token#create call in the StripeConnect gateway --- spec/factories.rb | 5 +++++ spec/requests/stripe_connect_checkout_spec.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/spec/factories.rb b/spec/factories.rb index 6592dc2940..14c97d0f55 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -363,6 +363,11 @@ FactoryGirl.define do end end + factory :stripe_payment_method, :class => Spree::Gateway::StripeConnect do + name 'Stripe' + environment 'test' + end + factory :stripe_account do enterprise { FactoryGirl.create :distributor_enterprise } stripe_user_id "abc123" diff --git a/spec/requests/stripe_connect_checkout_spec.rb b/spec/requests/stripe_connect_checkout_spec.rb index 247f8fb81e..776426911e 100644 --- a/spec/requests/stripe_connect_checkout_spec.rb +++ b/spec/requests/stripe_connect_checkout_spec.rb @@ -8,7 +8,7 @@ describe "Submitting Stripe Connect charge requests", type: :request do let!(:enterprise) { create(:distributor_enterprise) } let!(:exchange) { create(:exchange, order_cycle: order_cycle, sender: order_cycle.coordinator, receiver: enterprise, incoming: false, pickup_time: "Monday") } let!(:shipping_method) { create(:shipping_method, calculator: Spree::Calculator::FlatRate.new(preferred_amount: 0), distributors: [enterprise]) } - let!(:payment_method) { create(:payment_method, type: "Spree::Gateway::StripeConnect", distributors: [enterprise]) } + let!(:payment_method) { create(:stripe_payment_method, distributors: [enterprise], preferred_enterprise_id: enterprise.id) } let!(:stripe_account) { create(:stripe_account, enterprise: enterprise) } let!(:line_item) { create(:line_item, price: 12.34) } let!(:order) { line_item.order }