Hi,<br>
<br>
I'm very new to rspec, so if this is not the right forum please let me know.<br>
<br>
I'm starting to spec my models first in an existing rails app, porting from a mix of Test::Unit, and simply_bdd amongst others.<br>
<br>
I'm at the point where I want to test that certain associations are
present. What I'm not sure of is should I test the association or
the method and return object.<br>
<br>
That is, if I wanted to test a has_many should I:<br>
<br>
Confirm the methods exist, and that the return an array etc<br>
<br>
OR<br>
<br>
Check that the model has the named has_many association through it's reflections.<br>
<br>
On one hand the second one looks like it will be a bit more robust,
since if there is a has_many relationship, then all the associated
methods may be used througout the app. This would put testing in
the one place. <br>
<br>
On the other hand, this would be really testing the implementation of
the model rather than it's behaviour. The behaviour is to
call @article.comments and have an array of comments returned.<br>
<br>
Any thoughts?<br>
Cheers<br>
Daniel<br>
<br>