Merge branch 'master' into registry-662

This commit is contained in:
Artur Beljajev 2018-04-17 13:41:46 +03:00
commit 4bae19b66d
61 changed files with 644 additions and 225 deletions

View file

@ -0,0 +1,14 @@
require 'test_helper'
class AdminAreaNewMailTemplateTest < ActionDispatch::IntegrationTest
setup do
login_as users(:admin)
end
def test_new_mail_template_does_not_throw_template_error
visit admin_mail_templates_url
click_link_or_button 'New'
assert_text "HTML body"
assert_text "New mail template"
end
end

View file

@ -0,0 +1,18 @@
require 'test_helper'
class AdminAreaRegistrarDetailsTest < ActionDispatch::IntegrationTest
include ActionView::Helpers::NumberHelper
setup do
login_as users(:admin)
@registrar = registrars(:complete)
end
def test_registrar_details
visit admin_registrar_path(@registrar)
assert_text 'Accounting customer code US0001'
assert_text 'VAT number US12345'
assert_text 'VAT rate 5.0%'
assert_text 'Language English'
end
end

View file

@ -12,6 +12,7 @@ class AdminAreaNewRegistrarTest < ActionDispatch::IntegrationTest
fill_in 'Name', with: 'Brand new names'
fill_in 'Reg no', with: '55555555'
fill_in 'Contact e-mail', with: 'test@example.com'
select 'United States', from: 'Country'
fill_in 'Accounting customer code', with: 'test'
fill_in 'Code', with: 'test'

View file

@ -1,19 +0,0 @@
require 'test_helper'
class ShowRegistrarTest < ActionDispatch::IntegrationTest
include ActionView::Helpers::NumberHelper
setup do
login_as users(:admin)
@registrar = registrars(:bestnames)
visit admin_registrar_path(@registrar)
end
def test_accounting_customer_code
assert_text 'bestnames'
end
def test_language
assert_text 'Language English'
end
end

View file

@ -0,0 +1,25 @@
require 'test_helper'
class BalanceTopUpTest < ActionDispatch::IntegrationTest
setup do
login_as users(:api_bestnames)
end
def test_creates_new_invoice
Setting.registry_vat_prc = 0.1
visit registrar_invoices_url
click_link_or_button 'Add deposit'
fill_in 'Amount', with: '25.5'
assert_difference 'Invoice.count' do
click_link_or_button 'Add'
end
invoice = Invoice.last
assert_equal BigDecimal(10), invoice.vat_rate
assert_equal BigDecimal('28.05'), invoice.total
assert_text 'Please pay the following invoice'
end
end