[rspec-users] BlackBox testing

Jed Hurt jed.hurt at gmail.com
Mon Jun 18 20:45:42 EDT 2007

I am porting SWX (swxformat.org) to Ruby. It's a data exchange format
that assembles data structures into native SWF bytecode.

Here's my dilemma: The original SWX implementation (PHP) tests a lot
of methods that wouldn't be included in the public API (if PHP
properly supported encapsulation that is). The PHP implementation
really only includes a single public method—writeSWF. Basically, you
pass writeSWF a data structure, and it returns SWF bytecode.

Pretty simple on the surface, but the actual SwfCompiler class is
monolithic ( http://svn1.cvsdude.com/osflash/swx/trunk/php/SwfCompiler.php

Here's my question: I lean towards protecting as many methods of my
classes as possible. Protect first, then make public if it becomes
necessary to do so. Following the original implementation, my only
public method would be SwfCompiler#write_swf.

But how can I drive my implementation by specifying only one method?
I'd have to blindly write a couple hundred lines of protected methods
before I implemented any examples.

What is the common prescription to overcome such a scenario?

More information about the rspec-users mailing list