Checking ActiveRecord Associations in RSpec.

Posted by alokswain on Stack Overflow See other posts from Stack Overflow or by alokswain
Published on 2010-04-20T06:30:09Z Indexed on 2010/04/20 6:33 UTC
Read the original article Hit count: 241

Filed under:
|
|
|

I am learning how to write test cases using Rspec. I have a simple Post Comments Scaffold where a Post can have many Comments. I am testing this using Rspec. How should i go about checking for Post :has_many :comments. Should I stub Post.comments method and then check this with by returning a mock object of array of comment objects? Is testing for AR associations really required ?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about rspec