title: Rails RSpec Tests for a has_many :through Relationship
body: <p>I'm new to testing and rails but i'm trying to get my TDD process down properly. </p>
  
  <p>I was wondering if you use any sort of paradigm for testing has_many :through relationships? (or just has_many in general i suppose).</p>
  
  <p>For example, i find that in my model specs i'm definitely writing simple tests to check both ends of a relationship for relating methods.</p>
  
  <p>ie:</p>
  
  <pre><code>require 'spec_helper'
  
  describe Post do
  
    before(:each) do
      @attr = { :subject =&gt; "f00 Post Subject", :content =&gt; "8ar Post Body Content" }
    end
  
    describe "validations" do
    ...    
    end
  
    describe "categorized posts" do
  
      before(:each) do
        @post  = Post.create!(@attr)
      end
  
      it "should have a categories method" do
        @post.should respond_to(:categories)
      end
  
    end
  
  end
  </code></pre>
  
  <p>Then in my categories spec i do the inverse test and check for @category.posts </p>
  
  <p>What else am i missing?  thanks!!</p>