title: Rails app runs fine, but RSpec fails to match a route
body: <p>I have a fairly simple controller 'ActivityLogsController' in an 'Admin' namespace. When running <code>rails server</code> everything works as expected and I can access routes like <strong>/admin/activity_logs</strong>. When I run RSpec controller specs, every action test returns a failure. For example:</p>
  
  <pre><code> Failure/Error: get :index
  
   ActionController::UrlGenerationError:
     No route matches {:action=&gt;"index", :controller=&gt;"activity_logs"}
  </code></pre>
  
  <p>OK, I admit this looks a little strange, not showing the :controller value being namespaced. That is obviously part of the issue.</p>
  
  <p>The <strong>routes.rb</strong> has the activity_logs entry correctly namespaced:</p>
  
  <pre><code> namespace :admin do
     resources :activity_logs, except: [:show, :destroy]
   end
  </code></pre>
  
  <p>Of course, running <code>rake routes</code> gives me the expected namespaced routes, which reflects the fact that the server runs correctly.</p>
  
  <p>The controller is defined in 'app/controllers/admin/activity_logs_controller.rb', reflecting its namespace. It is defined as:</p>
  
  <pre><code>class Admin::ActivityLogsController &lt; ApplicationController
     ...
  end
  </code></pre>
  
  <p>So, why does the RSpec controller spec fail to resolve the routes correctly?</p>
  
  <p>I'm posting this one with an answer, in case others have failed to find what they need in other questions.</p>