[rspec-users] How to spec a (Trollop-based) binary’s internal state?
Shot (Piotr Szotkowski)
shot at hot.pl
Fri Nov 7 12:24:21 EST 2008
Pat Maddox:
> "Shot (Piotr Szotkowski)" <shot at hot.pl> writes:
>> it 'should set the debug option properly' do
>> `binary -d`
>> Conf.should_receive(:debug=).with true
>> end
> When you use backticks to execute the binary, it runs in
> a separate process, so you can't use mock expectations like that.
Right, that’s why I suggested I could Kernel#eval the binary’s contents
in the current process instead. This would require tricking Trollop, but
I assume I could trick it by hand-crafting ARGV.
> I think you're kind of missing the intention though...
Yeah, I thought so – that’s why I’m asking. :) The previous question
ended up with the conclusion that RSpecing a ‘binary’ through Kernel#`
is a sane way to go:
¹ http://groups.google.com/group/rspec/browse_thread/thread/66dc48522014c5eb
> what I think you want to do is write features with
> cucumber that use the built binary from the outside.
Ah, Cucumber. :) I’ve yet to write my first story; I somehow assumed
these are more oriented toward non-programmers and/or for driving
implementation on a rather higher level, and have to be ‘implemented’
on the RSpec level somehow anyway. I take that these assumptions are
flawed. :)
> But when you write code-level examples, you are not going to run the
> binary. You're just writing examples at a lower level, directly for
> the objects. Make sense?
Hm, I guess I simply need to read up on Cucumber and stories;
I still can’t see how this kind of specification would differ
(in the end) from Kernel#`-based RSpec – i.e., why implementing
the code behind these stories would side-step the underlying issue.
(But the last time I read on stories was pre-Cucumber.)
Is there an example of story/Cucumber-based specification
of a binary’s behaviour available somewhere out there?
-- Shot
--
init.d is complete in the sense that brainfuck
is Turing-complete. -- SanityInAnarchy, /.
-------------- 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/20081107/191a707f/attachment.bin>
More information about the rspec-users
mailing list