# Unit test failure

**URL:** <https://www.ruby-forum.com/t/unit-test-failure/120567>\
**Category:** Rails\
**Created:** [November 18, 2007, 5:22pm UTC](https://www.ruby-forum.com/t/unit-test-failure/120567 "2007-11-18T17:22:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![specpro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/50afbb/32.png) [@specpro](https://www.ruby-forum.com/u/specpro)\
**Post date:** [November 18, 2007, 5:22pm UTC](https://www.ruby-forum.com/t/unit-test-failure/120567/1 "2007-11-18T17:22:42Z")

</div>

Getting the following Failures in my unit test. Can someone point me  
in the right direction?:

1. Failure:  
test\_email\_with\_invalid\_examples(UserTest)  
[./test/unit/user\_test.rb:134:in  
`test_email_with_invalid_examples' ./test/unit/user_test.rb:131:in`each’  
./test/unit/user\_test.rb:131:in  
`test\_email\_with\_invalid\_examples’]:  
\<“must be a valid email address”\> expected but was  
\<[“must be a valid email address”, “must be valid.”]\>.

Thanks for your help

S

---

<div class="post-metadata">

**Author:** ![specpro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/50afbb/32.png) [@specpro](https://www.ruby-forum.com/u/specpro)\
**Post date:** [November 19, 2007, 12:19am UTC](https://www.ruby-forum.com/t/unit-test-failure/120567/2 "2007-11-19T00:19:33Z")

</div>

I think you must be checking model.errors rather than  
model.errors.on(:email). If you post your UserTest for  
test\_email\_with\_invalid\_examples I might be able to help.

---

<div class="post-metadata">

**Author:** ![specpro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/50afbb/32.png) [@specpro](https://www.ruby-forum.com/u/specpro)\
**Post date:** [November 19, 2007, 5:48pm UTC](https://www.ruby-forum.com/t/unit-test-failure/120567/3 "2007-11-19T17:48:37Z")

</div>

I think I found the problem already. I had two tests that were  
checking for the same thing and when I commented out the tests that  
returns “must be valid” the failure went away and the test/assertion  
passed ok. does that sound right to you? thanks for your help!

s
