Danger Will Robinson

Posted by Peter Morris Fri, 04 Apr 2008 03:03:00 GMT

I like RSPEC, I LOVE RSPEC. But, this morning, I found a flaw in its beauty.

If you are using a lambda to verify that a block of code raises an exception it works fine.

A problem occurs if you are using a lambda like….

lambda {
… do some stuff …
}.should_not raise_error(SomeSpecificErrorClass)

to check that an error of that type is not raised.

The problem is, that the ‘raise_error’ will trap errors looking for the specific type of error you are asking for, but, in doing so, it only takes notice of the specific type of error you mention, and traps but ignores all others. So, if an expectation within the block fails, this will not be reported.

Significant problem!

Agile ain't about FAST.... 3

Posted by Peter Morris Thu, 06 Sep 2007 04:48:00 GMT

… it’s about GOOD.

Using Agile techniques, Rails for instance, or any of the other new frameworks popping up more quickly than mushrooms on a cowturn in a darkened room, and things like TDD, BDD, SPEC driven whatever, is NOT about writing code FASTER than previously.

Its about writing code in an acceptable timescale that is maintainable, extensible and more easily supportable.

Sure, if you develop in rails and forgo all the speccing, test script converage etc, you can write code more quickly than the guy in the next cubicle, but what about the poor bloke (possibly you) who has to support it into the future.

Writing in Rails with good test/spec coverage, and careful design, takes time. But the framework itself saves you enough time with respect to other platforms that this extra time is actually saved from other activities.

Expecting a well written RAILS development to be VASTLY quicker than using some other set of tools AND to expect it to be better quality and easier to support is wishing for your cake and eating it too.

Good code takes TIME, it takes THOUGHT.

RSPEC: Am I going too far.

Posted by Peter Morris Wed, 22 Aug 2007 09:41:00 GMT

I just had a nice idea for how to make my current application prettier.

Instead of stopping what I was doing (an item on the critical path, not ‘fluff’) and doing it, I added it as an unimplemented expectation in the appropriate place in the RSPEC files.

Which brings up a nice idea, I am going to capture the user requirements from my next meeting with the client in RSPEC.

Hmmmm, is this a spec too far?

Wonderful wonderful Copenhagen, no, wait, erm.... Autotest...

Posted by Peter Morris Wed, 15 Aug 2007 14:20:00 GMT

Over the last day or so, I have been playing with RSPEC. I must admit, its NICE.

What makes it even nicer, is using autotest

This is a nice addon that will automatically run your tests or rspecs when you change files and save them in your rails project.

Even nicer, you can coax it to talk to growl and get the tests to notify you onscreen as to progress.

Really wonderful. and not a daffodil in sight.