Ruby on Rails, no se me está inicializando el estado de las tablas al ejecutar un test
Estaba yo haciendo unos testecitos y veo que no se me estaban borrando los datos de la base de datos al ejecutar cada test lo cual me estaba generando unos poltergeist horribles.
Un comportamiento de Rails en el que confiaba como era este: “La base de datos vuelve al estado original en cada test“, me estaba traicionando.
Bueno el problema era que como mis tests no usaban fixturas no las estaba cargando y resulta que es la carga de las fixturas lo que borra la bd y no la propia suite de tests.
Solución:
fixtures :mimodelos
Aunque no use las fixturas es lo que he tenido que hacer para que la tabla se borrase con cada test.
¡Qué cosas!
Julio 22nd, 2014 at 5:38 am
Hey there! I could have sworn I’ve been to this website
before but after reading through some of the post I realized it’s new to me.
Anyhow, I’m definitely glad I found it and I’ll be book-marking and checking back often!
Agosto 4th, 2014 at 4:49 pm
We stumbled over here different web address and
thought I may as well check things out. I like what I
see so now i’m following you. Look forward to checking out your
web page for a second time.
My site … Vegetarian Indian Food Recipes
Diciembre 20th, 2014 at 12:06 pm
I pay a visit everyday a few web sites and blogs to read content, however this website presents feature based content.