title: Testing JS actions in a Rails controller, the response is always empty
body: <p>having a views:</p>
  
  <pre><code># views/users/index.html.erb
  &lt;%= link_to 'Destroy', user_destroy_path(user), remote: :true %&gt;
  </code></pre>
  
  <p>having a destroy action:</p>
  
  <pre><code># controllers/users_controller.rb
  respond_to :js
  
  def destroy
     @user = user.find(params.require(:id))
     @user.destroy
  end
  </code></pre>
  
  <p>which renders:</p>
  
  <pre><code># views/users/destroy.js.erb
  $('#some_div').html('Bye Bye' + user.name);
  </code></pre>
  
  <p>I want to write controller tests test for it</p>
  
  <pre><code># spec/controllers/users_controller_spec.rb
  describe UsersController do 
    it 'says goodbye' do
       delete :destroy, id: user
       expect(response.body).to include('Bye Bye #{user.name}')
    end 
  end
  </code></pre>
  
  <p>but "response.body" is always empty string. Why? How to examine content of js response?</p>