[rspec-users] [rspec]. Inexplicable error in simple specs

David Chelimsky dchelimsky at gmail.com
Sun May 3 09:40:58 EDT 2009


On Sun, May 3, 2009 at 3:36 AM, Juanma Cervera <lists at ruby-forum.com> wrote:
> Well
> It seems that the problem is not with the view integration but with the
> fixtures.
> I didn't know if the fixtures loaded in the spec of a controller may
> affect the specs of the model, but they indeed do.
> I thought each spec runs in its own database transaction and the data
> does not affect other spec. Is it true?

Assuming everything is set up correctly, yes. But there are several
things that could break that, including:

* the wrong configuration in spec/spec_helper.rb
* the wrong type of database tables in mysql (gotta use innodb)
* setting up fixtures in before(:all) instead of before(:each)

Also, this sort of thing is often a sign that the either the examples
are leaking state by setting up globals, or the app itself might be
doing so.

HTH,
David

> Thanks
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list