Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error en tests al correr Rspec #147

Open
raibd opened this issue Nov 5, 2021 · 2 comments
Open

Error en tests al correr Rspec #147

raibd opened this issue Nov 5, 2021 · 2 comments

Comments

@raibd
Copy link

raibd commented Nov 5, 2021

Hola, al correr bundle exec rspec me da un error en algunos tests donde en uno sale:

Failure/Error: let(:answer) {create(:answer)}

ActiveRecord::RecordInvalid:
Validation failed: User must exist, Question must exist

en el caso del test para el modelo Answer, que contiene un foreign key de una Question y un User (los id's en este caso). Mi pregunta es como agrego estos id's al answer que se crea. Lo que supongo que pasa es que al testear la instancia de answer no se tienen los valores de foreign keys de User y Question.

Gracias.

@dammr54
Copy link

dammr54 commented Nov 16, 2021

tengo el mismo error, por favor si alguien puede responder

@raibd
Copy link
Author

raibd commented Nov 16, 2021

@dammr54 Hola lo resolví hace harto pero se me olvido el issue, el error era que no habia hecho los tests de la carpeta request/ (dentro de spec/).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants