Refactor email sending, tests

This commit is contained in:
Martin Lensment 2015-04-23 10:59:45 +03:00
parent d3c17ce4e3
commit 12e32af524
3 changed files with 24 additions and 7 deletions

View file

@ -20,9 +20,7 @@ class Registrar::InvoicesController < RegistrarController
@invoice.billing_email = params[:invoice][:billing_email]
if @invoice.forward
pdf = @invoice.pdf(render_to_string('pdf', layout: false))
InvoiceMailer.invoice_email(@invoice, pdf).deliver_now
if @invoice.forward(render_to_string('pdf', layout: false))
flash[:notice] = t('invoice_forwared')
redirect_to([:registrar, @invoice])
else