move subs jobs out of spree namespace

This commit is contained in:
Andy Brett
2021-01-21 09:09:41 -08:00
parent 3da0c2e386
commit e694449dcc
2 changed files with 4 additions and 4 deletions

View File

@@ -97,7 +97,7 @@ class SubscriptionConfirmJob < ActiveJob::Base
def send_payment_authorization_emails(order)
order.payments.each do |payment|
if payment.cvv_response_message.present?
Spree::PaymentMailer.authorize_payment(payment).deliver
PaymentMailer.authorize_payment(payment).deliver
end
end
end

View File

@@ -282,20 +282,20 @@ describe SubscriptionConfirmJob do
before do
allow(order).to receive(:payments) { [payment] }
allow(Spree::PaymentMailer).to receive(:authorize_payment) { mail_mock }
allow(PaymentMailer).to receive(:authorize_payment) { mail_mock }
end
it "sends authorization email if a payment requires it" do
allow(payment).to receive(:cvv_response_message) { "http://redirect_url" }
job.send(:send_payment_authorization_emails, order)
expect(Spree::PaymentMailer).to have_received(:authorize_payment)
expect(PaymentMailer).to have_received(:authorize_payment)
expect(mail_mock).to have_received(:deliver)
end
it "does not send authorization email if no payment requires it" do
allow(payment).to receive(:cvv_response_message) { nil }
job.send(:send_payment_authorization_emails, order)
expect(Spree::PaymentMailer).not_to have_received(:authorize_payment)
expect(PaymentMailer).not_to have_received(:authorize_payment)
expect(mail_mock).not_to have_received(:deliver)
end
end