From 2c07c1b080f7cf18438b34b6c54079e512a01704 Mon Sep 17 00:00:00 2001 From: Flavio Auciello Date: Fri, 6 Mar 2020 14:37:54 +0100 Subject: [PATCH] Fix feature specs with new CC expiration date --- spec/features/backend/new_payment_spec.rb | 7 ++++--- .../frontend/braintree_credit_card_checkout_spec.rb | 9 ++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/spec/features/backend/new_payment_spec.rb b/spec/features/backend/new_payment_spec.rb index 624eba17..00b0eb0b 100644 --- a/spec/features/backend/new_payment_spec.rb +++ b/spec/features/backend/new_payment_spec.rb @@ -6,6 +6,7 @@ let!(:gateway) { create :payment_method } let!(:order) { create(:completed_order_with_totals, number: 'R9999999') } let(:pending_case_insensitive) { /pending/i } + let(:expiration) { "02/#{Date.current.year.next}"} before(:each) do braintree.save! @@ -44,7 +45,7 @@ fill_in("credit-card-number", with: "4111111111111111") end within_frame("braintree-hosted-field-expirationDate") do - fill_in("expiration", with: "02/2020") + fill_in("expiration", with: expiration) end within_frame("braintree-hosted-field-cvv") do fill_in("cvv", with: "123") @@ -79,7 +80,7 @@ fill_in("credit-card-number", with: "1111111111111111") end within_frame("braintree-hosted-field-expirationDate") do - fill_in("expiration", with: "02/2020") + fill_in("expiration", with: expiration) end within_frame("braintree-hosted-field-cvv") do fill_in("cvv", with: "123") @@ -110,7 +111,7 @@ fill_in("credit-card-number", with: "4111111111111111") end within_frame("braintree-hosted-field-expirationDate") do - fill_in("expiration", with: "02/2020") + fill_in("expiration", with: expiration) end within_frame("braintree-hosted-field-cvv") do fill_in("cvv", with: "123") diff --git a/spec/features/frontend/braintree_credit_card_checkout_spec.rb b/spec/features/frontend/braintree_credit_card_checkout_spec.rb index 06c1edb4..0e5a4110 100644 --- a/spec/features/frontend/braintree_credit_card_checkout_spec.rb +++ b/spec/features/frontend/braintree_credit_card_checkout_spec.rb @@ -5,6 +5,9 @@ let(:braintree) { new_gateway(active: true) } let!(:gateway) { create :payment_method } let(:three_d_secure_enabled) { false } + let(:card_number) { "4111111111111111" } + let(:card_expiration) { "01/#{Time.now.year+2}" } + let(:card_cvv) { "123" } before(:each) do braintree.save! @@ -49,10 +52,6 @@ cassette_name: 'checkout/valid_credit_card', match_requests_on: [:braintree_uri] } do - let(:card_number) { "4111111111111111" } - let(:card_expiration) { "01/#{Time.now.year+2}" } - let(:card_cvv) { "123" } - include_context "frontend checkout setup" before do @@ -136,7 +135,7 @@ fill_in("credit-card-number", with: "4111111111111111") end within_frame("braintree-hosted-field-expirationDate") do - fill_in("expiration", with: "02/2020") + fill_in("expiration", with: card_expiration) end within_frame("braintree-hosted-field-cvv") do fill_in("cvv", with: "123")