mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Extract Stripe credit card form filling
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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" }
|
||||
|
||||
Reference in New Issue
Block a user