[rspec-users] Test data problem (in general and with acts_as_tree)
dchelimsky at gmail.com
Tue Feb 26 07:09:11 EST 2008
On Tue, Feb 26, 2008 at 5:41 AM, Edvard Majakari <edvard at majakari.net> wrote:
> > My problems seem to be arising from the fact that when i run the test, the
> > objects i created last time are still in the database. Shouldn't they be
> > cleared out automatically? This in turn is preventing me from saving root
> I don't know RSpec that well, but I'd guess before(:all) is run only
> once in a describe block (and as such torn down only after the block
> is finished), whereas before(:each) is run before every example (and
> torn down respectively). So, I guess you'll want to use before(:each)
> Was that it?
Yep. Use before(:each) and all should be well.
> "One day, when he was naughty, Mr Bunnsy looked over the hedge into
> Farmer Fred's field and it was full of fresh green lettuces. Mr
> Bunnsy, however, was not full of lettuces. This did not seem fair."
> -- Terry Pratchett, Mr. Bunnsy Has An Adventure
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users