title: Rspec can't find route in controller test
body: <p>I keep getting a routing error when testing a Rails 3.0 application with Rspec 3. It can't detect the route I'm using for my get request. Here's what my files look like:</p>
  
  <p>routes.rb</p>
  
  <pre><code>resources :proficiency_tests do
    member do
      resource :lag_components, only: [:edit, :update]
    end
  end
  </code></pre>
  
  <p>running rake:routes returns: </p>
  
  <pre><code>edit_lag_components GET    /proficiency_tests/:id/lag_components/edit(.:format)    {:action=&gt;"edit", :controller=&gt;"lag_components"}
       lag_components PUT    /proficiency_tests/:id/lag_components(.:format)         {:action=&gt;"update", :controller=&gt;"lag_components"}
  </code></pre>
  
  <p>controller is in:</p>
  
  <pre><code>app
  |---controllers
      |---lag_components_controller.rb
  </code></pre>
  
  <p>Nothing special about the way the controller is set up.</p>
  
  <p>spec is in:</p>
  
  <pre><code>spec
      |---controllers
          |---lag_components_controller.rb
  </code></pre>
  
  <p>tests are set up like this:</p>
  
  <p>require 'spec_helper'</p>
  
  <pre><code>describe LagSubmissionsController do
    describe 'GET #edit' do
      let(:proficiency_test) { create :proficiency_test }
  
      it 'redirects' do
        *tests*    
      end
    end
  end
  </code></pre>
  
  <p>Here is what I have tried and what the error messages have been:</p>
  
  <pre><code>get(:edit, id: proficiency_test.id)
  # =&gt; No route matches {:id=&gt;11259, :controller=&gt;"lag_submissions", :action=&gt;"edit"}
  
  get(:edit, id: proficiency_test.id, use_route: :edit_lag_components)
  # =&gt; No route matches {:id=&gt;11260, :controller=&gt;"lag_submissions", :action=&gt;"edit"}
  
  get("/proficiency_tests/#{proficiency_test.id}/lag_components/edit")
  # =&gt; No route matches {:controller=&gt;"lag_submissions", :action=&gt;"/proficiency_tests/11258/lag_components/edit"}
  </code></pre>
  
  <p>The last one is particularly intriguing, because that is the exact route I use in the browser to render the <code>edit</code> page:</p>
  
  <p><a href="https://i.stack.imgur.com/FwYIh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FwYIh.png" alt="enter image description here"></a></p>
  
  <p>Does anyone know what's going on and why it can't find that route? Unfortunately, it's an older application and I can't change the routes around.</p>