[rspec-users] RSpecing a ‘binary’
ashley.moran at patchspace.co.uk
Sat Oct 25 07:28:11 EDT 2008
On Oct 25, 2008, at 8:08 am, Shot (Piotr Szotkowski) wrote:
> ‘From outside’ (i.e., run it with Kernel#` and observe output and
> side-effects)? This feels more like behaviour testing, and I’m leaning
> towards it, but I have a gut feeling there might be another choice
> I’m missing…
When I've written command-line tools, I've done exactly this. Use
Dir.tmpdir to give you a working space to hold any input/output files,
and call it with Kernel#` to capture its STDOUT.
Doing it this way proves your binary command works, because RSpec (or
Cucumber, which may be more appropriate here) is doing nothing you
can't do in a shell yourself.
More information about the rspec-users