mirror of
https://github.com/internetee/registry.git
synced 2025-08-17 23:13:54 +02:00
Test reference_no parsing from transaction description
This commit is contained in:
parent
8a5208057a
commit
90b5baa29d
1 changed files with 18 additions and 0 deletions
|
@ -156,6 +156,24 @@ class BankTransactionTest < ActiveSupport::TestCase
|
||||||
assert transaction.errors.full_messages.include?('Cannot bind cancelled invoice')
|
assert transaction.errors.full_messages.include?('Cannot bind cancelled invoice')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_assumes_7_digit_number_is_reference_no_in_desc
|
||||||
|
statement = BankTransaction.new
|
||||||
|
statement.description = 'number 1234567 defo valid'
|
||||||
|
assert_equal '1234567', statement.parsed_ref_number
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_determines_correct_ref_no_from_description
|
||||||
|
statement = BankTransaction.new
|
||||||
|
ref_no = registrars(:bestnames).reference_no
|
||||||
|
statement.description = "invoice 123 125 55 4521 #{ref_no} 7541 defo valid"
|
||||||
|
assert_equal ref_no.to_s, statement.parsed_ref_number
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_parsed_ref_no_returns_nil_if_ref_not_found
|
||||||
|
statement = BankTransaction.new
|
||||||
|
statement.description = "all invalid 12 123 55 77777 --"
|
||||||
|
assert_nil statement.parsed_ref_number
|
||||||
|
end
|
||||||
private
|
private
|
||||||
|
|
||||||
def create_payable_invoice(attributes)
|
def create_payable_invoice(attributes)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue