title: Testing controller's redirect in RSpec
body: <p>I have a rspec test testing a controller action.</p>
  
  <pre><code>class SalesController &lt; ApplicationController
    def create
      # This redirect sends the user to SalesController#go_to_home
      redirect_to '/go_to_home'
    end
  
    def go_to_home
      redirect_to '/'
    end
  end
  </code></pre>
  
  <p>My controller test looks like</p>
  
  <pre><code>RSpec.describe SalesController, type: :controller do
    include PathsHelper
  
    describe 'POST create' do
      post :create
  
      expect(response).to redirect_to '/'
    end
  end
  </code></pre>
  
  <p>However, when I run the test it tells me that: </p>
  
  <pre><code>   Expected response to be a redirect to &lt;http://test.host/&gt; but was a redirect to &lt;http://test.host/go_to_home&gt;.
     Expected "http://test.host/" to be === "http://test.host/go_to_home".
  </code></pre>
  
  <p><code>/go_to_home</code> will send the user to SalesController#go_to_home. How can I test that the response will eventually lead to the home page with the url <code>http://test.host/</code>?</p>