Fix specs for saved credit cards: Add payment profile ID to fixture (now denotes that a card has been saved), check for current user to avoid error attempting to inject saved cards as a guest

This commit is contained in:
stveep
2017-08-23 09:22:04 +01:00
committed by Rob Harrington
parent 511afa0ddc
commit f065cbe251
3 changed files with 8 additions and 4 deletions

View File

@@ -639,7 +639,7 @@ GEM
tilt (~> 1.1, != 1.3.0)
state_machine (1.2.0)
stringex (1.3.3)
stripe (3.0.1)
stripe (3.3.1)
faraday (~> 0.9)
therubyracer (0.12.0)
libv8 (~> 3.16.14.0)
@@ -777,7 +777,7 @@ DEPENDENCIES
spree_auth_devise!
spree_i18n!
spree_paypal_express!
stripe (~> 3.0.1)
stripe (~> 3.3.1)
therubyracer
timecop
truncate_html

View File

@@ -74,7 +74,10 @@ module InjectionHelper
end
def inject_saved_credit_cards
data = spree_current_user.credit_cards.with_payment_profile.all
if spree_current_user
data = spree_current_user.credit_cards.with_payment_profile.all
end
inject_json_ams "savedCreditCards", data, Api::CreditCardSerializer
end

View File

@@ -150,7 +150,8 @@ feature "As a consumer I want to check out my cart", js: true, retry: 3 do
year: "2025",
cc_type: "Visa",
number: "1111111111111111",
payment_method_id: stripe_pm.id)
payment_method_id: stripe_pm.id,
gateway_customer_profile_id: "i_am_saved")
}
let(:response_mock) { { id: "ch_1234", object: "charge", amount: 2000} }