mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 07:04:47 +02:00
Add paid flag to email subject, check receipt date in tests
This commit is contained in:
parent
82c048b316
commit
235ef9ba3e
5 changed files with 32 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class ProcessPaymentsTaskTest < ActiveSupport::TestCase
|
||||
class ProcessPaymentsTaskTest < ActiveJob::TestCase
|
||||
setup do
|
||||
@payment_amount = payment_amount = 0.1
|
||||
@payment_currency = payment_currency = 'EUR'
|
||||
|
@ -162,6 +162,28 @@ class ProcessPaymentsTaskTest < ActiveSupport::TestCase
|
|||
assert_equal 0.1, registrar.invoices.last.total
|
||||
end
|
||||
|
||||
def test_topup_creates_invoice_and_send_it_as_paid
|
||||
registrar = registrars(:bestnames)
|
||||
@invoice.payment_orders.destroy_all
|
||||
@invoice.destroy
|
||||
|
||||
perform_enqueued_jobs do
|
||||
run_task
|
||||
end
|
||||
|
||||
invoice = Invoice.last
|
||||
assert invoice.paid?
|
||||
assert_not invoice.e_invoice_sent_at.blank?
|
||||
|
||||
pdf_source = Invoice::PdfGenerator.new(invoice)
|
||||
pdf_source.send(:invoice_html).include?('Receipt date')
|
||||
|
||||
email= ActionMailer::Base.deliveries.last
|
||||
assert email.subject.include?('already paid')
|
||||
|
||||
assert_equal 0.1, registrar.invoices.last.total
|
||||
end
|
||||
|
||||
def test_output
|
||||
assert_output "Transactions processed: 1\n" do
|
||||
run_task
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue