开发者

Rails 3 model valid when it should not be

Can someone tell me why my test keeps failing when I try to confirm uniqueness of the email attribute in my model. When I test this in the Rails console, it works correctly, but when I run the unit tests in the console, it fails with this error message:

Rails 3 model valid when it should not be

This is my model:

Rails 3 model valid when it should not be

And here is the unit test that keeps failing:

Rails 3 model valid when it should not be

The reason the unit test keeps fai开发者_运维问答ling is that it says that invalid_user is valid when it shouldn't be. Can someone please help me figure out why this is failing -- it's getting on my nerves that I can't figure it out lol?

Thanks!


Your name and email fields should be database fields, not attr_accessors. Perhaps you meant to make this attr_accessible instead?


Try:

:uniqueness => true

I don't see the true part in there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜