[rspec-users] RSpecing a ‘binary’

Shot (Piotr Szotkowski) shot at hot.pl
Sat Oct 25 03:08:12 EDT 2008

Hello, good folk of rspec-users.

I’m writing my first Ruby ‘binary’ (i.e., a script meant to be used
as a standalone system command) and I’m wondering how to RSpec it.

(Caveat: With all of my other code I almost alwyas do BDD, but as this
was my first ‘binary’ and these were my first Trollop steps, I ended up
writing the code first.)

‘From inside’? This means turning most of the script into one (or few)
callable method(s) and then testing them; the idea of accomodating the
code to be easier to test seems to miss the point, though.

‘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 that
I’m missing…

-- Shot
Exchange actually reports two different INTERNALDATEs for the exact
same message when queried at different points in time. [...] Of course
no OTHER imap server I've encountered returns DIFFERENT values for
the SAME message. But it's Microsoft; what do you expect? If their
programmers were any good they'd be working at Google.   -- sup/imap.rb
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081025/3c7bc9f9/attachment.bin>

More information about the rspec-users mailing list