[rspec-users] skip pending
Jonathan Linowes
jonathan at parkerhill.com
Mon Oct 8 15:43:11 EDT 2007
fyi, In the meantime I've written a little helper
def skip_pending(text='')
puts "SKIP PENDING #{text}"
end
so I can do
And "foo foo bar bar" do
skip_pending "Implement foo bar"
end
On Oct 1, 2007, at 10:44 PM, Jonathan Linowes wrote:
> The way I've started using story runner is to write the story and
> scenarios, and then implement each step incrementally. The order
> that I implement is not necessarily the order its logically
> written. Lets say I want to get the story working without the
> authentication, so a Given clause and a Then clause might be
> pending; but I'd still want the story to run though the rest of the
> stuff. I tried calling pending("TO DO") in the do end block,but
> that gave same result. Well, what if we added a new method, like
> skip_this_because("authentication not implemented yet") ?? :)
>
>
> On Oct 1, 2007, at 5:10 PM, Dan North wrote:
>
>> Hi Jonathan.
>>
>> The pending method uses an exception to fail fast out of the step,
>> but the runner knows it's a special case so it treats it
>> accordingly. That's why pending steps or scenarios are reported
>> differently from failures in the runner. It would be easy to
>> reimplement pending using Ruby's throw/catch mechanism which is
>> separate from the exception mechanism, I just didn't think to do
>> it at the time. (Plus, the rspec example runner uses exceptions
>> too so it makes sense for the story runner to do the same.)
>>
>> As for the first pending (or failing) step terminating the
>> scenario, this is a tricky one. You don't want the scenario to
>> carry on executing because something has already gone wrong
>> (either by failing or simply by not being implemented yet), but
>> there are listeners that want to know what other steps would have
>> run, for documentation for example.
>>
>> I am thinking of something like this: once a step fails, iterate
>> over the remaining steps in the scenario, passing them into the
>> found_step method on any documenters, but not actually executing
>> the steps. This would strike a balance between actually executing
>> the steps - which wouldn't make sense - and simply ignoring them,
>> which makes the documentation look weird.
>>
>> Maybe they could be coloured differently in the (as-yet-unwritten)
>> html story documenter, so you would have a bunch of green steps,
>> one red or yellow step (the failing or pending one), and the
>> remaining unexecuted ones in grey.
>>
>>
>> On 10/1/07, Jonathan Linowes <jonathan at parkerhill.com> wrote:
>> If you add the pending statement before other non-pending ones, it
>> stops at the first pending one. That forces me to implement them in
>> the order specified, a rough example:
>>
>> Then "user was authorized to perform this action"
>>
>> And "action was completed correctly" do
>> ...
>> end
>>
>>
>>
>> On Sep 14, 2007, at 7:10 PM, Pat Maddox wrote:
>>
>> > On 9/14/07, Evan David Light < evan at tiggerpalace.com> wrote:
>> >>
>> >> I've been using RSpec in anger for perhaps a total of a few days
>> >> and just
>> >> started playing with Story Runner. Love it.
>> >>
>> >> I also started working on a patch, which ought to be simple, to
>> >> allow for
>> >> Scenarios without supplied blocks to be treated as pending -- much
>> >> like "it"
>> >> in Spec::DSL::ExampleAPI.
>> >>
>> >> That said, I noticed something that seemed odd and chatted
>> with Rein
>> >> Henrichs a little about it on #rspec. ScenarioRunner#run treats
>> >> "pending"
>> >> scenarios as an error case. We both believed this to be a little
>> >> odd as we
>> >> both thought that pending would just be a branch and not an
>> >> error. That
>> >> said, I thought that there may be a reasonable explanation.
>> >>
>> >> Evan Light
>> >> IMs (all): sleight42
>> >> Twitter: elight
>> >> http://evan.tiggerpalace.com
>> >> _______________________________________________
>> >> rspec-users mailing list
>> >> rspec-users at rubyforge.org
>> >> http://rubyforge.org/mailman/listinfo/rspec-users
>> >>
>> >
>> > Hrm...I added
>> >
>> > And "this should be pending" do
>> > pending "need something else"
>> > end
>> >
>> > to the end of one of my stories and got:
>> >
>> > And this should be pending
>> > P
>> > 4 scenarios: 3 succeeded, 0 failed, 1 pending
>> >
>> > I agree that it would be nice if story runner treats an empty
>> > Given/When/Then as pending. But what do you mean it treats
>> pending as
>> > an error case?
>> >
>> > Pat
>> > _______________________________________________
>> > rspec-users mailing list
>> > rspec-users at rubyforge.org
>> > http://rubyforge.org/mailman/listinfo/rspec-users
>>
>> _______________________________________________
>> rspec-users mailing list
>> rspec-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users
>>
>> _______________________________________________
>> rspec-users mailing list
>> rspec-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20071008/8180836c/attachment.html
More information about the rspec-users
mailing list