[Rspec-devel] Skeleton Generator
dastels at daveastels.com
Fri Aug 11 20:42:42 EDT 2006
-----BEGIN PGP SIGNED MESSAGE-----
On 11-Aug-06, at 8:30 PM, Judson Lester wrote:
> Perhaps there's a philosophical point I'm missing, and it would
> be enlightening to me (and maybe others) if you could show me where
> going wrong. Let me make an example:
> I write the following:
> context "A fresh pack of cards" do
> setup do
> @deck = Deck.new(52)
> specify "should be shuffleable" do
First of all, this makes no statement about behaviour. All that it
is doing is sending the "shuffle" message to @deck. No behaviour is
being specified. What is the result or side-effect of Deck.shuffle?
Also, nothing is said about the purpose/meaning/value of the argument
to Deck.new. What happens for Deck.new(0)? Deck.new(104)?
> And the following is generated:
> class Deck
> def initialize(number)
> def shuffle
> Now I can review the generated code, and then add specify blocks to my
> spec file in order to drive development.
> What purpose does this defeat?
There is no failing specification/example/test/anything, therefore
there should be no code. The whole idea is that you write a tiny bit
of spec... just enough to fail because the required behaviour does
not exist. Then you write just enough code to satisfy the spec that
is failing. How is having automated generation of any help?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
-----END PGP SIGNATURE-----
More information about the Rspec-devel