diff --git a/spec/features/consumer/shopping/checkout_stripe_spec.rb b/spec/features/consumer/shopping/checkout_stripe_spec.rb index 09d0444029..e9b5e65230 100644 --- a/spec/features/consumer/shopping/checkout_stripe_spec.rb +++ b/spec/features/consumer/shopping/checkout_stripe_spec.rb @@ -109,11 +109,7 @@ feature "Check out with Stripe", js: true do save_default_addresses: false ) - expect(page).to have_css("input[name='cardnumber']") - - fill_in 'Card number', with: '4242424242424242' - fill_in 'MM / YY', with: "01/#{DateTime.now.year + 1}" - fill_in 'CVC', with: '123' + fill_out_card_details place_order @@ -145,11 +141,7 @@ feature "Check out with Stripe", js: true do save_default_addresses: false ) - expect(page).to have_css("input[name='cardnumber']") - - fill_in 'Card number', with: '4242424242424242' - fill_in 'MM / YY', with: "01/#{DateTime.now.year + 1}" - fill_in 'CVC', with: '123' + fill_out_card_details place_order diff --git a/spec/support/request/stripe_helper.rb b/spec/support/request/stripe_helper.rb index 82b858a3da..e05ee92bbb 100644 --- a/spec/support/request/stripe_helper.rb +++ b/spec/support/request/stripe_helper.rb @@ -1,6 +1,13 @@ # frozen_string_literal: true module StripeHelper + def fill_out_card_details + expect(page).to have_css("input[name='cardnumber']") + fill_in 'Card number', with: '4242424242424242' + fill_in 'MM / YY', with: "01/#{DateTime.now.year + 1}" + fill_in 'CVC', with: '123' + end + def setup_stripe allow(Stripe).to receive(:api_key) { "sk_test_12345" } allow(Stripe).to receive(:publishable_key) { "pk_test_12345" }