title: Error testing rendering of partial with rspec
body: <p>I'm writing rspec tests for my controller and trying to test the rendering of a partial, when the action is triggered by an AJAX requisition.</p>
  
  <p>In my controller code, I have:</p>
  
  <pre><code>def new
    ...
    respond_to do |format|
      format.html { render action: "new" }
      format.js   { }
    end
  end
  </code></pre>
  
  <p>I have the files <code>new.html.erb</code> and <code>new.js.erb</code> placed the correct view directory.</p>
  
  <p>And my rspec test is the following:</p>
  
  <pre><code>it "should render the new partial" do
    get :new, :format =&gt; 'js'
    response.should render_template(:partial =&gt; 'new')
  end
  </code></pre>
  
  <p>When executing this rspec test I get the following error:</p>
  
  <pre><code>Failure/Error: response.should render_template(:partial =&gt; 'new')
    expecting partial &lt;"new"&gt; but action rendered &lt;[]&gt;
  </code></pre>
  
  <p>Can somebody figure why I am getting this error? What am I doing wrong?</p>
  
  <p>Thank you</p>