[rspec-users] How to spec a (Trollop-based) binary’s internal state?

Ashley Moran ashley.moran at patchspace.co.uk
Sat Nov 15 05:51:11 EST 2008

On Nov 14, 2008, at 8:56 pm, Shot (Piotr Szotkowski) wrote:

> Heh – I brought exactly this talk up twice when talking about specing
> binaries here (it was what pointed me in the direction that it would
> be actually good to spec/test them, actually). :)

Ha, so you did :)

There was a delay after I read your email to when I finally replied,  
in that time it clearly left my head...

> In my case, asfter some specing and some coding, it turns out I can’t
> really do this the way I wanted; most of the cases I need to test for
> are triggered with input that makes the binary run a long time (it’s
> the code behind my PhD thesis, so tons of computations). As I’m  
> testing
> a black box with Kernel#`, I can’t mock/stub anything out.

Well, like Matt says, all the binary needs to do is get your code up  
and running.  For that, I imagine you can use selectively-chosen  
inputs that don't produce long run times.  The cucumber files just  
need to prove that all the command line options work, and that the app  
is directing IO to and from the right places.  The details of the  
algorithms can be dealt with in your spec suite.



More information about the rspec-users mailing list