I like nice…

One geeky artist’s ongoing mission for nice…

Flunking a test

leave a comment »

When I write unit tests in Java, I sometimes want to assert a fail to force the test to fail. Generally because this is because I’m testing something that hasn’t been thought about yet and I want to leave myself a nagging note to do something about it… In Java I’d do something like:

assert(false);

test/unit, the testing library used by Rails, has a really lovely named method: ‘flunk’ – for when you just want to flunk and test and cause a fail:

flunk ( [msg] )

One of the nicest things about Rails and ‘convention over configuration’ is that things are named well. After all, there are only two great problems in computer science; cache invalidation and naming things!

Advertisement

Written by ilikenice

March 31, 2009 at 9:03 am

Posted in Programming

Tagged with , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.