mardi 15 septembre 2015

Feature test for command line program Ruby / RSpec

I have a script that I want to run within some tests using RSpec that I want to test the input / output on.

For example,

I have a script 'script.rb' that I run using 'ruby script.rb'

The script then outputs to STDOUT and takes an input using STDIN. I want to test this using RSPec and check that everything works appropriately (a feature test). How would I go about doing this? Just do an execute 'ruby script.rb' within RSPec and then test that the output is what I expect and that it takes input from STDIN?

Aucun commentaire:

Enregistrer un commentaire