mirror of
https://github.com/internetee/registry.git
synced 2025-08-02 16:02:03 +02:00
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
This commit is contained in:
parent
7e0fd30125
commit
27ea790b28
30 changed files with 288 additions and 138 deletions
|
@ -1,9 +1,13 @@
|
|||
require 'test_helper'
|
||||
|
||||
class AdminAreaInvoicesTest < ApplicationSystemTestCase
|
||||
include ActionMailer::TestHelper
|
||||
|
||||
setup do
|
||||
sign_in users(:admin)
|
||||
@invoice = invoices(:one)
|
||||
|
||||
ActionMailer::Base.deliveries.clear
|
||||
end
|
||||
|
||||
def test_cancels_an_invoice
|
||||
|
@ -17,4 +21,23 @@ class AdminAreaInvoicesTest < ApplicationSystemTestCase
|
|||
assert @invoice.cancelled?
|
||||
assert_text 'Invoice has been cancelled'
|
||||
end
|
||||
|
||||
def test_invoice_delivery_form_is_pre_populated_with_billing_email_of_a_registrar
|
||||
assert_equal 'billing@bestnames.test', @invoice.buyer.billing_email
|
||||
visit new_admin_invoice_delivery_url(@invoice)
|
||||
assert_field 'Recipient', with: 'billing@bestnames.test'
|
||||
end
|
||||
|
||||
def test_delivers_an_invoice
|
||||
visit admin_invoice_url(@invoice)
|
||||
click_on 'Send'
|
||||
fill_in 'Recipient', with: 'billing@registrar.test'
|
||||
click_on 'Send'
|
||||
|
||||
assert_emails 1
|
||||
email = ActionMailer::Base.deliveries.first
|
||||
assert_equal ['billing@registrar.test'], email.to
|
||||
assert_current_path admin_invoice_path(@invoice)
|
||||
assert_text 'Invoice has been sent'
|
||||
end
|
||||
end
|
|
@ -1,9 +1,13 @@
|
|||
require 'test_helper'
|
||||
|
||||
class RegistrarAreaInvoicesTest < ApplicationSystemTestCase
|
||||
include ActionMailer::TestHelper
|
||||
|
||||
setup do
|
||||
sign_in users(:api_bestnames)
|
||||
@invoice = invoices(:one)
|
||||
|
||||
ActionMailer::Base.deliveries.clear
|
||||
end
|
||||
|
||||
def test_cancels_an_invoice
|
||||
|
@ -17,4 +21,23 @@ class RegistrarAreaInvoicesTest < ApplicationSystemTestCase
|
|||
assert @invoice.cancelled?
|
||||
assert_text 'Invoice has been cancelled'
|
||||
end
|
||||
|
||||
def test_invoice_delivery_form_is_pre_populated_with_billing_email_of_a_registrar
|
||||
assert_equal 'billing@bestnames.test', @invoice.buyer.billing_email
|
||||
visit new_registrar_invoice_delivery_url(@invoice)
|
||||
assert_field 'Recipient', with: 'billing@bestnames.test'
|
||||
end
|
||||
|
||||
def test_delivers_an_invoice
|
||||
visit registrar_invoice_url(@invoice)
|
||||
click_on 'Send'
|
||||
fill_in 'Recipient', with: 'billing@registrar.test'
|
||||
click_on 'Send'
|
||||
|
||||
assert_emails 1
|
||||
email = ActionMailer::Base.deliveries.first
|
||||
assert_equal ['billing@registrar.test'], email.to
|
||||
assert_current_path registrar_invoice_path(@invoice)
|
||||
assert_text 'Invoice has been sent'
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue