[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
> "Shot (Piotr Szotkowski)" <shot at hot.pl> writes:
>> it 'should set the debug option properly' do
>> `binary -d`
>> Conf.should_receive(:debug=).with true
> 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:
> 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
> 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?
init.d is complete in the sense that brainfuck
is Turing-complete. -- SanityInAnarchy, /.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 191 bytes
Desc: not available
More information about the rspec-users