[Rspec-devel] Failure messages - customize per "should"assertion

David Astels dastels at daveastels.com
Sun May 28 15:43:39 EDT 2006


On 28-May-06, at 1:33 PM, itsme213 wrote:

>> part 2: This is the failed should_*. The purpose is to communicate  
>> the
>> detailed information about it, such as why something failed and where
>> (line number).
>
> The line_number is necessary not always sufficient. In the same  
> spirit as
> generating user-readable narrative specs from spec, we might aim for
> user-readable spec-failure reports, which could need more dynamic  
> context
> than a static "specify" string can provide.

Specifications should be as simple and minimalistic as possible.   
I.e. having as few expectations as is possible, ideally a single  
one.  Thos expectations should be simple & clear.  Knowing the lin  
number should provide as much information as you need to know what  
the failure is.  If it doesn't, then it is likely that the  
specification and/or expectation is too complex, and you should  
consider makign it simpler.  It is possible that you are working at  
too high a level of granularity/abstraction.

Dave



More information about the Rspec-devel mailing list