Add test for invoice_number_counter counter_zero_or_positive constraint
This commit is contained in:
parent
775cdef097
commit
0e20eab46a
|
@ -5,7 +5,7 @@ reset client_min_messages;
|
|||
|
||||
begin;
|
||||
|
||||
select plan(27);
|
||||
select plan(28);
|
||||
|
||||
set search_path to numerus, auth, public;
|
||||
|
||||
|
@ -116,11 +116,19 @@ reset role;
|
|||
|
||||
select lives_ok( $$
|
||||
insert into invoice_number_counter (company_id, year, currval)
|
||||
values (2, 2008, 0)
|
||||
values (2, 2009, 0)
|
||||
$$,
|
||||
'Should allow starting a counter from zero'
|
||||
);
|
||||
|
||||
select throws_ok( $$
|
||||
insert into invoice_number_counter (company_id, year, currval)
|
||||
values (2, 2008, -1)
|
||||
$$,
|
||||
'23514', 'new row for relation "invoice_number_counter" violates check constraint "counter_zero_or_positive"',
|
||||
'Should not allow starting a counter from a negative value'
|
||||
);
|
||||
|
||||
select throws_ok( $$
|
||||
insert into invoice_number_counter (company_id, year, currval)
|
||||
values (2, -2008, 1)
|
||||
|
|
Loading…
Reference in New Issue