title: In Rails, how do you functional test a Javascript response format?
body: <p>If your controller action looks like this:</p>
  
  <pre><code>respond_to do |format|
    format.html { raise 'Unsupported' }
    format.js # index.js.erb
  end
  </code></pre>
  
  <p>and your functional test looks like this:</p>
  
  <pre><code>test "javascript response..." do
    get :index
  end
  </code></pre>
  
  <p>it will execute the HTML branch of the respond_to block.</p>
  
  <p>If you try this:</p>
  
  <pre><code>test "javascript response..." do
    get 'index.js'
  end
  </code></pre>
  
  <p>it executes the view (index.js.erb) withOUT running the controller action!</p>