On Thu, Jul 26, 2012 at 4:08 PM, James Cox <ja...@imaj.es> wrote:
> Chris,
>
> On Tue, Jul 24, 2012 at 4:54 PM, Chris Flipse <cfli...@gmail.com> wrote:
>>
>>
>>
>> On Tue, Jul 24, 2012 at 1:55 PM, James Cox <ja...@imaj.es> wrote:
>>>
>>> so yes, pending is ok, but a second keyword "broken" might be nicer,
>>> which would act the same but output different info.--
>>
>>
>> There is a block form of pending.  It actually executes the contents of
>> the block, but outputs as a pending test -- unless the test passes, in which
>> case it fails with a differing message:
>>
>>   it "is a broken test that I need to fix sometime" do
>>     pending("broke on nonesuch upgrade") {
>>       domain.do_failing_thing
>>     }
>>   end
>>
>> So,  that shows up in test output just like every other pending note.
>> Whenever someone gets around to fixing whatever failed, the contents of the
>> block start passing -- and the test will fail.  The failure is a signal to
>> remove the pending block from around the test.
>>
>> This may not be as helpful as you like, if it's drowning in a sea of true
>> "pending" tests ... but I feel that leaving unimplemented, pending tests in
>> the suite for a long time is a Bad Thing -- precisely because you loose
>> useful information like this.
>
>
> One of the examples i've found for commented out tests is when the code
> plainly doesn't work. Wouldn't it also fail (and output a backtrace) in this
> instance, therefore thoroughly confusing whoever is observing the test
> output? I do like the idea of this though: pend it until it passes, and then
> fail because you should check it, but … i dont' imagine that it'd really
> work that way.

No - this form passes if there is either an error or a failed
expectation (which is also an error, but internal to rspec). It will
only fail when the code works without event. This means that if the
code doesn't actually do anything it all, it will fail, but that never
happens in practice in my experience.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to