[rspec-users] simple == with prettier error messages + good documentation

Nick Hoffman nick at deadorange.com
Thu Jan 29 16:46:46 EST 2009


On 29/01/2009, at 4:27 PM, aslak hellesoy wrote:
> On Thu, Jan 29, 2009 at 10:14 PM, David Chelimsky <dchelimsky at gmail.com 
> > wrote:
>> On Thu, Jan 29, 2009 at 2:38 PM, Nick Hoffman <nick at deadorange.com>  
>> wrote:
>>> I like "on_failure", as it's consistent with RSpec's output. Eg:
>>> 31 examples, 0 failures
>>>
>>> What could be done to make the construct more sentence-like? If  
>>> used in this
>>> manner:
>>>
>>> it 'should do something' do
>>> on_failure "@foo is nil" do
>>>   @foo.should_not be_nil
>>> end
>>> end
>>>
>>> It reads like this to me:
>>> If "@foo is nil" fails, execute the block.
>>>
>>> These are a bit verbose, but what do you think these approaches?:
>>> http://gist.github.com/54726
>>
>> I'll take that gist and raise you one:
>>
>> http://gist.github.com/54750 (Suggestion #3)
>
> Upped:
>
> http://gist.github.com/54758

Putting the message at the end is a great idea! I still think that  
naming the method (and thus starting the block) with "on_failure" is a  
bit misleading when read aloud...but maybe that's not a big concern  
for you guys?

What do you think about this modification to #3?:
http://gist.github.com/54770


More information about the rspec-users mailing list