Test::DatabaseRow improvements

2shortplanks on 2003-09-08T11:07:47

Andy bugged me on irc yesterday about some of the changes I'd been promising to make to Test::DatabaseRow for ages, ever since pudge suggested them after I'd just released the module. The module used to just check that you got at least one row back from the database and that the assertions matched the first row returned. I've now updated it so it can check it got the correct number of rows back too.

This is most critical when you want to say that actually you want no rows at all back from the database - so you can now use Test::DatabaseRow to assert that nothing matching this SELECT statement is in the database.

I also wanted to add functionality that allows you to say how many of the returned rows must match the assertions. Typical values will be 'the first one' (default) 'at least one' 'all of them' 'at least n'. However, when I sat down to think about implementation, I realised that this is quite a bit harder than I first imagined, at least in terms of providing a nice interface and helpful debug information for failing tests. So, the XP fairy sitting over my left shoulder handily pointed out that I'd made the minimum changes I'd needed to, and I should stop.

So, latest release on the CPAN, expect another release soonish (when I get another blast of JFDI.)

And anyway, that's work code, and it was the weekend, darnit!