Shoulda Doesn’t like ‘Status’
One of the models in a project I am working on right now ends in ‘status’. Rails handles that just find but in my tests I started noticing an odd error:
test: Lookup should belong_to lookup_status. (LookupTest):
NameError: uninitialized constant LookupStatu
</pre>
The Shoulda test looks like this:
should_belong_to :lookup_status
</pre>
Nothing to complicated there. Should recognizes the relationship just find but when it tries to find a class it goes looking for LookupStatu. I fixed this by adding the the class name to the relationship thus:
belongs_to :lookup_status, :class_name => 'LookupStatus'
</pre>