Created
August 13, 2019 15:25
-
-
Save apolishch/73edfce2ef8171e09a8aed1a3f11bd00 to your computer and use it in GitHub Desktop.
Advanced Schema Tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN; | |
SELECT plan(2); | |
INSERT INTO payments(1, 99, 'failed'); | |
PREPARE insert_failure AS | |
INSERT INTO payments VALUES(10, -7, 'failed'); | |
PREPARE second_failure AS | |
INSERT INTO policies VALUES(11, 1, 'annual'); | |
SELECT throws_ok( | |
'insert_failure', | |
'23514', | |
'new row for relation "payments" violates check constraint "amount_less_than_0"' | |
); | |
SELECT throws_ok( | |
'second_failure', | |
'P0001', | |
'can only bind succeeded payments' | |
); | |
SELECT * FROM finish(); | |
ROLLBACK; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment