This project is archived and is in readonly mode.

#1161 ✓committed

improved reporting of failed expression in assert_difference

Reported by madlep | October 3rd, 2008 @ 05:12 AM | in 2.x

Patch improves message output when an expression specified in #assert_difference fails. This is useful for when there are multiple expressions provided as an array to help identify which one was actually in error.

Currently assert_difference just outputs that the expected and actual value was, but not what actually failed.

assert_difference ['Post.count', 'current_user.posts.count'] do

If one of the expressions fails in the above code, there is no way to tell from the assertion failure message which one: <1> expected but was <0>.

With the patch, the message will be: <current_user.posts.count> was expression that failed. <1> expected but was <0>.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>


Referenced by