added generator reference number which comes from billing system

This commit is contained in:
olegphenomenon 2022-01-26 15:36:42 +02:00
parent 9b6b8a5e2f
commit 84669297b5
8 changed files with 86 additions and 26 deletions

View file

@ -7,6 +7,18 @@ class ReferenceNoTest < ActiveSupport::TestCase
end
def test_generated_reference_number_conforms_to_format
stub_request(:post, "http://eis_billing_system:3000/api/v1/invoice_generator/reference_number_generator").
with(
body: "{\"initiator\":\"registry\"}",
headers: {
'Accept'=>'Bearer WA9UvDmzR9UcE5rLqpWravPQtdS8eDMAIynzGdSOTw==--9ZShwwij3qmLeuMJ--NE96w2PnfpfyIuuNzDJTGw==',
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
'Authorization'=>'Bearer foobar',
'Content-Type'=>'application/json',
'User-Agent'=>'Ruby'
}).
to_return(status: 200, body: "{\"reference_number\":\"12332\"}", headers: {})
reference_no = Billing::ReferenceNo.generate
assert_match Billing::ReferenceNo::REGEXP, reference_no
end