assert_difference eval magic in [6693]

I just saw Marcel's change to assert_difference that changes the method API to take a string param that is evaled in a lambda.

http://dev.rubyonrails.org/changeset/6693

I much preferred the old API, since it's simple enough to pass a lambda. Passing a string means the lambda is in the wrong scope and doesn't have access to objects in the test case scope.

For an example of how I was using the old API:

http://blog.hasmanythrough.com/2007/5/2/getting-arbitrary-with-assert_difference

Wouldn't lambda { eval(expression, block.binding) } take care of that?

marcel

http://blog.hasmanythrough.com/2007/5/2/getting-arbitrary-with- assert_difference

That's pretty nice, but a lambda and :call is a bit nasty, and I like the string for simple cases (all the ({}) stuff is a bit like line noise). I'd take a patch which can accept a string, or a lambda though.

Any issues with this?

% svn diff Index: test/test_test.rb