Commit 75b2eba0 authored by Alex Buijs's avatar Alex Buijs Committed by Doug Stull

Do not require credit card validation when it is present

When visiting the group creation page during signup,
a credit card verification is required.
This change removes the requirement when it is already present.

Changelog: fixed
EE: true
parent cd7c5343
......@@ -19,6 +19,8 @@ module Registrations::Verification
end
def set_requires_verification
return if current_user.credit_card_validation.present?
::Users::UpdateService.new(current_user, user: current_user, requires_credit_card_verification: true).execute!
end
end
......
......@@ -67,5 +67,15 @@ RSpec.describe Registrations::Verification do
it 'sets the requires_credit_card_verification attribute' do
expect { get :new }.to change { user.reload.requires_credit_card_verification }.to(true)
end
context 'when a credit card validation exists' do
before do
create(:credit_card_validation, user: user)
end
it 'does not change the requires_credit_card_verification attribute' do
expect { get :new }.not_to change { user.reload.requires_credit_card_verification }
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment