Fix tests

#623
This commit is contained in:
Artur Beljajev 2018-03-14 23:53:53 +02:00
parent f8088df798
commit 69d0a20115
4 changed files with 32 additions and 27 deletions

View file

@ -30,3 +30,14 @@ not_in_use:
country_code: US
accounting_customer_code: any
language: en
complete:
name: Complete Names
reg_no: 123456
code: completenames
email: completenames@example.com
country_code: US
accounting_customer_code: US0001
language: en
vat_no: US12345
vat_rate: 0.05

View file

@ -0,0 +1,18 @@
require 'test_helper'
class AdminAreaRegistrarDetailsTest < ActionDispatch::IntegrationTest
include ActionView::Helpers::NumberHelper
def setup
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

@ -1,27 +0,0 @@
require 'test_helper'
class ShowRegistrarTest < ActionDispatch::IntegrationTest
include ActionView::Helpers::NumberHelper
def setup
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
def test_vat_no
assert_text 'US12345'
end
def test_vat_rate
assert_text vat_rate(@registrar.vat_rate)
end
end

View file

@ -44,6 +44,9 @@ class RegistrarVATTest < ActiveSupport::TestCase
@registrar.vat_rate = ''
assert @registrar.invalid?
assert @registrar.errors.added?(:vat_rate, :blank)
@registrar.vat_rate = 5
assert @registrar.valid?
end
def test_require_no_vat_rate_when_registrar_is_foreign_vat_payer_and_vat_no_is_present