# Spec::Rails, "model.should have(1).error\_on(:attribute)" passes when?

**URL:** <https://www.ruby-forum.com/t/spec-rails-model-should-have-1-error-on-attribute-passes-when/163689>\
**Category:** Rails\
**Created:** [March 23, 2009, 11:41pm UTC](https://www.ruby-forum.com/t/spec-rails-model-should-have-1-error-on-attribute-passes-when/163689 "2009-03-23T23:41:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bornboulder](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e274bd/32.png) [@bornboulder](https://www.ruby-forum.com/u/bornboulder)\
**Post date:** [March 23, 2009, 11:41pm UTC](https://www.ruby-forum.com/t/spec-rails-model-should-have-1-error-on-attribute-passes-when/163689/1 "2009-03-23T23:41:06Z")

</div>

Spec::Rails people,  
I’m curious about:

- model.should have(1).error\_on(:attribute)  
displayed in the URL below:  
[http://rspec.rubyforge.org/rspec-rails/1.2.2/classes/Spec/Rails/Exten](http://rspec.rubyforge.org/rspec-rails/1.2.2/classes/Spec/Rails/Exten)…  
The Rspec peepcode screencast suggests that  
model.should have(1).error\_on(:attribute)  
should pass if  
model.send(:attribute)  
returns nil  
For me, I get an exception from the rspec script.  
My work-around is simple.  
Instead of:
- model.should have(1).error\_on(:attribute)  
I Use:  
-model.send(:attribute).should be\_nil  
But now I have the question:
- What kind of error causes:
  - model.should have(1).error\_on(:attribute)
  - to pass ??  
–b
