diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 8203a630f..f0e42344b 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -89,4 +89,8 @@ module ApplicationHelper
types.delete('ddoc')
".#{types.join(',.')}"
end
+
+ def vat_rate(value)
+ number_to_percentage(value, precision: 1)
+ end
end
diff --git a/app/views/admin/registrars/_billing.html.erb b/app/views/admin/registrars/_billing.html.erb
index 7ba778d08..929487afe 100644
--- a/app/views/admin/registrars/_billing.html.erb
+++ b/app/views/admin/registrars/_billing.html.erb
@@ -8,7 +8,7 @@
<%= registrar.vat_no %>
<%= Registrar.human_attribute_name :vat_rate %>
- <%= number_to_percentage registrar.vat_rate, precision: 1 %>
+ <%= vat_rate registrar.vat_rate %>
<%= Registrar.human_attribute_name :accounting_customer_code %>
<%= registrar.accounting_customer_code %>
diff --git a/app/views/registrar/invoices/partials/_items.haml b/app/views/registrar/invoices/partials/_items.haml
index 560b3e1f6..2d485f0ab 100644
--- a/app/views/registrar/invoices/partials/_items.haml
+++ b/app/views/registrar/invoices/partials/_items.haml
@@ -24,7 +24,7 @@
%td= currency(@invoice.subtotal)
%tr
%th.no-border{colspan: 3}
- %th= t('vat', rate: number_to_percentage(@invoice.vat_rate, precision: 1))
+ %th= t('vat', rate: vat_rate(@invoice.vat_rate))
%td= currency(@invoice.vat)
%tr
%th.no-border{colspan: 3}
diff --git a/app/views/registrar/invoices/pdf.haml b/app/views/registrar/invoices/pdf.haml
index e59ca618b..fcc68f128 100644
--- a/app/views/registrar/invoices/pdf.haml
+++ b/app/views/registrar/invoices/pdf.haml
@@ -242,7 +242,7 @@
%td= "#{currency(@invoice.subtotal)} #{@invoice.currency}"
%tr
%th.no-border{colspan: 3}
- %th= t('vat', rate: number_to_percentage(@invoice.vat_rate, precision: 1))
+ %th= t('vat', rate: vat_rate(@invoice.vat_rate))
%td= "#{currency(@invoice.vat)} #{@invoice.currency}"
%tr
%th.no-border{colspan: 3}
diff --git a/test/integration/admin/registrars/show_registrar_test.rb b/test/integration/admin/registrars/show_registrar_test.rb
index d4ed927bd..94252705e 100644
--- a/test/integration/admin/registrars/show_registrar_test.rb
+++ b/test/integration/admin/registrars/show_registrar_test.rb
@@ -22,6 +22,6 @@ class ShowRegistrarTest < ActionDispatch::IntegrationTest
end
def test_vat_rate
- assert_text number_to_percentage(@registrar.vat_rate, precision: 1)
+ assert_text vat_rate(@registrar.vat_rate)
end
end