Can't test controller render due to ActiveRecord::StatementInvalid:error
|Added at||2016-12-22 13:12|
Ok, I have this controller code:
And I would like to test if it re-renders the new page when the user email is invalid. To do that, I created this test:
However, the test is failing due to this error:
The Foo table has a
so that it does not add a foo without a user.
I think this error is actually a desired behavior, since it prevents the foo to be saved without a user and the user cant be saved with an invalid email. But I still need to test it, so am I testing it wrongly? How can I do that? Is there something missed?
Thanks in advance!