On Apr 16, 2008, at 6:22 PM, Joe Van Dyk wrote:

> I've got some code that should run before any stories execute.
> Where's a good place to put that?  (need to create a @sessions and
> @users hash)

The story framework has as simple listener API (not documented, but  
otherwise nice):

class StorySetupListener
   def run_started(num_scenarios)
     # do your stuff here
   end

   def method_missing(method, *args)
     # no-op
   end
end

Spec::Story::Runner.register_listener(StorySetupListener.new)

Give that a whirl.

Cheers,
David

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to