diff options
Diffstat (limited to 'spec/services/users/upsert_credit_card_validation_service_spec.rb')
-rw-r--r-- | spec/services/users/upsert_credit_card_validation_service_spec.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/spec/services/users/upsert_credit_card_validation_service_spec.rb b/spec/services/users/upsert_credit_card_validation_service_spec.rb index 952d482f1bd..ac7e619612f 100644 --- a/spec/services/users/upsert_credit_card_validation_service_spec.rb +++ b/spec/services/users/upsert_credit_card_validation_service_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe Users::UpsertCreditCardValidationService do - let_it_be(:user) { create(:user) } + let_it_be(:user) { create(:user, requires_credit_card_verification: true) } let(:user_id) { user.id } let(:credit_card_validated_time) { Time.utc(2020, 1, 1) } @@ -21,7 +21,7 @@ RSpec.describe Users::UpsertCreditCardValidationService do end describe '#execute' do - subject(:service) { described_class.new(params) } + subject(:service) { described_class.new(params, user) } context 'successfully set credit card validation record for the user' do context 'when user does not have credit card validation record' do @@ -42,6 +42,10 @@ RSpec.describe Users::UpsertCreditCardValidationService do expiration_date: Date.new(expiration_year, 1, 31) ) end + + it 'sets the requires_credit_card_verification attribute on the user to false' do + expect { service.execute }.to change { user.reload.requires_credit_card_verification }.to(false) + end end context 'when user has credit card validation record' do |