On 3/16/08, David Chelimsky <[EMAIL PROTECTED]> wrote:
> On Fri, Mar 14, 2008 at 8:12 PM, Rick DeNatale <[EMAIL PROTECTED]> wrote:
>  > I'm trying to use stories to drive some high-level design.

> > ... So far it's been working fairly well,
>  >  but I've run into a few quirks.
>  >
>  >  1)  I've been working through my scenarios, and I'd commented out the
>  >  later ones to cut down on the 'pending' output while I develop the
>  >  steps.  I'd get one scenario working and then go on to the next.  So
>  >  at one point my plain text story looked something like this:
>  >
>  >      Scenario A
>  >           Given ...
>  >            When ...
>  >            Then ...
>  >
>  >    #Scenario B
>  >    #   GivenScenario A
>  >    #   Given ...
>  >    #    ...
>  >
>  >  And I got Scenario A working and uncommented the next scenario, or so I 
> thought:
>  >    Scenario A
>  >           Given ...
>  >            When ...
>  >            Then ...
>  >
>  >    #Scenario B
>  >       GivenScenario A
>  >       Given ...
>  >
>  >  It took me a while to debug the resulting infinite loop.  Perhaps
>  >  GivenScenario should check to see that it's not asking for the CURRENT
>  >  scenario.
>
>
> Patches welcome :)

Fair enough, I'll look at that when I find the time.

>  >  2)  Having figured that out and moving on,  I now have another
>  >  problem, which is what's the best way to clean up the database so that
>  >  Scenario A can run again if it assumes that the stuff it put in the DB
>  >  isn't there each time it runs. Cleaning the DB after running the
>  >  scenario won't work since it defeats the purpose of using the scenario
>  >  as a pre-condition.  Cleaning it before is more difficult,
>  >  particularly if I'm using parameterized steps.  It would be nice if I
>  >  could somehow use database transactions, but I don't see a nice way to
>  >  do that either.
>
>
> This should just work. If you look at story_adapter.rb, which defines
>  the RailsStory class (maybe we should align :) ) you'll see that the
>  transaction is opened when the scenario starts and rolled back when it
>  is finished. GivenScenario should not result in a call to any of the
>  scenario finished methods (scenario_succeeded, _pending, _failed), so
>  it should get rolled back.
>
>  If that's not happening, please do file a ticket.

Okay, right now, I'm not actually using rails stories since I'm
working through pure business logic sans a UI so there's been no need
for Rails "integration" testing.

On the other hand I guess it wouldn't hurt to "declare" them as rails stories.

-- 
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to