internetee-registry/test/mailers/invoice_mailer_test.rb
Artur Beljajev 27ea790b28 Refactor invoice PDF generation, download and delivery
- Remove `Que::Mailer` (#895)
- Extract controllers
- Extract translations
- Convert HAML to ERB
- Add mailer preview
- Improve UI
- Remove unused routes
- Add tests
2019-04-11 13:04:42 +03:00

22 lines
No EOL
569 B
Ruby

require 'test_helper'
class InvoiceMailerTest < ActiveSupport::TestCase
include ActionMailer::TestHelper
setup do
@invoice = invoices(:one)
ActionMailer::Base.deliveries.clear
end
def test_delivers_invoice_email
assert_equal 1, @invoice.number
email = InvoiceMailer.invoice_email(invoice: @invoice, recipient: 'billing@bestnames.test')
.deliver_now
assert_emails 1
assert_equal ['billing@bestnames.test'], email.to
assert_equal 'Invoice no. 1', email.subject
assert email.attachments['invoice-1.pdf']
end
end