[rspec-devel] Hooks in the story runner

David Chelimsky dchelimsky at gmail.com
Wed Nov 14 22:57:59 EST 2007

On Nov 13, 2007 6:26 PM, David Chelimsky <dchelimsky at gmail.com> wrote:
> On Nov 13, 2007 5:49 PM, Alvin Schur <a.schur at nucleus.com> wrote:
> > Is there a hook in the story runner that allows me to run code before
> > and after each scenario?
> >
> > My goal is to wrap each Scenario in a transaction to a second database.
> There's not now but I'm working on one. I'll follow up later today or tomorrow.

Following up:

I just committed an update that includes a hook that is NOT well
documented, but works like this:


There are a number of messages that get sent to the listeners. Just
implement the ones you want and override method_missing to ignore the

This will get doco soon, but I wanted to get this into trunk so you
could use it :)

As with all things StoryRunner at the moment, this is experimental and
subject to change. There WILL be a way to register a listener, so you
won't lose the capability. It's just that until we officially publish
an API for it, the hook might change (in name only) and the messages
might change as well. Probably not.


More information about the rspec-devel mailing list