title: Rspec: Controller specs for 2 level nested resources
body: <p>my routes.rb</p>
  
  <pre><code>  namespace :magazine do
     resources :pages do
       resources :articles do
         resources :comments
       end
     end
    end
  </code></pre>
  
  <p>While writing controller specs for Comments:</p>
  
  <pre><code>describe "GET 'index'" do
      before(:each) do
       @user = FactoryGirl.create(:user)
       @page = FactoryGirl.build(:page)
       @page.creator = @user
       @page.save
       @article = FactoryGirl.create(:article)
       @comment_attributes = FactoryGirl.attributes_for(:comment, :article_id =&gt; @article )
     end
  it "populates an array of materials" do
    get :index, ??
    #response.should be_success
    assigns(:comments)
  end
  
  it "renders the :index view" do
    get :index, ?? 
    response.should render_template("index")
  end
  
  end 
  </code></pre>
  
  <p>Any idea how to give the page and article reference to get :index ?? 
   if I give : get :index, :article_id => @article.id<br>
      Error I get is below:</p>
  
  <pre><code> Failure/Error: get :index, :article_id =&gt; @article.id
   ActionController::RoutingError:
     No route matches {:article_id =&gt;"3", :controller=&gt;"magazine/comments"}
  </code></pre>