[rspec-users] Understanding before(:all)

Stephen Eley sfeley at gmail.com
Wed Jan 14 10:16:43 EST 2009

On Sat, Jan 10, 2009 at 1:59 PM, David Richards
<drichards at showcase60.com> wrote:
> Can someone explain why there would be different behavior between
> running one file and many files and before(:each) vs. before(:all)?
> As far as I understand it, I thought before(:all) was supposed to
> always run before a group of specs.

It does, but not necessarily _immediately_ before.  My rough guess
would be that something in one of your other spec files called code
that that required or reloaded FasterCSV, which blew away your stub
when those other spec files were initialized after after this one.

State changes hurt.

Have Fun,
   Steve Eley (sfeley at gmail.com)
   ESCAPE POD - The Science Fiction Podcast Magazine

More information about the rspec-users mailing list