Making assert_difference's default message more helpful

I like assert_difference, but I find the error messages slightly unhelpful when I'm verifying more than one thing. Suppose something should create both a new customer and a question, I could write

assert_difference 'Question.count' do   assert_difference 'Customer.count' do     ...   end end

Unlike a normal assertion the test line causing the failure will be a few lines down the stack trace so it's not obvious to me with a quick glance which of the assertions have failed (although this is fixable by providing a custom failure message).

I'd rather write

assert_difference ['Question.count', 'Customer.count'] do   ... end

but if a failure occurs here then I genuinely don't know which assertion has failed (unless I can remember that 'expected 4 got 3' must be talking about the customer assertion because I remember the number of records defined in the fixtures).

It seems to me that this could be made more helpful if the default error message included the expression being evaluated eg something along the lines of

Customer.count: expected 4, got 3

Thoughts?

Fred

+1!

What about github.com/rails/rails/commit/00e2ba ?

D'oh - haven't moved stuff to 2.2 yet and hadn't notice that commit. Sorry for the noise!

Fred