Testing Commands That Die

Posted 5 months ago by arvisto

I've a command that drops the database and restores the structure from a schema dump, then calls migrate. I use it when I break my local db; it throws away the db and creates a brand spanking new one.

I added safeguards so that if you ever try to run it outside of local env it calls die().

My problem is I don't know how to test it. If I call it from within my tests expecting it to fail it will die and bring down the test suite with it.

Any suggestions? Fanks!

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.