# Unit testing.. assert model.errors.invalid?(:field)

**URL:** <https://www.ruby-forum.com/t/unit-testing-assert-model-errors-invalid-field/66861>\
**Category:** Rails\
**Created:** [August 29, 2006, 9:50pm UTC](https://www.ruby-forum.com/t/unit-testing-assert-model-errors-invalid-field/66861 "2006-08-29T21:50:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stewbawka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@stewbawka](https://www.ruby-forum.com/u/stewbawka)\
**Post date:** [August 29, 2006, 9:50pm UTC](https://www.ruby-forum.com/t/unit-testing-assert-model-errors-invalid-field/66861/1 "2006-08-29T21:50:31Z")

</div>

seems like the above line always evals to false… if the field is  
required and missing, it evals to false. if the field is required and  
present, it evals to false. if the field is not required and present  
(or not present) the line evals to false…

am i using this right? in AWDwR 2nd Ed thevery first example makes  
heavy use of this style of test…

thanks in advance…  
stuart
