I assume this is very newbie stuff but I'm learning Ruby by doing, and I'm doing a small CLI tool that receives a couple of parameters in order to do its stuff properly. This is my current workflow:
I want to test (using Minitest) all the possible flows:
- Exits with 0 and help message is shown if ARGV.count != 2
- Exists with 1 if first param is not correct
- Exists with 1 if second param is not correct
- Exists with 1 if both params are not correct
- Exists with 0 and does stuff if all params are correct
Now, if I run tests the only thing I see is the help output as there is no parameter being passed.
So, a couple of questions:
- How can I pass arguments to the main program in tests?
- How can I test the output? (I'm using
puts
)
Thanks!
Aucun commentaire:
Enregistrer un commentaire