title: Rspec controller action not found
body: <p>test is failing becasue it says the action does not exist, when it clearly does. Is it becasue it is a nested route?  Any thoughts?</p>
  
  <p>Update:</p>
  
  <p>I moved <code>resources :orders</code> outside of the nested route and tests passed.  So it has something to do with it being nested.</p>
  
  <p>OrderController</p>
  
  <pre><code>def index
      if current_printer
        @orders = Order.all
        @printer = Printer.find(params[:printer_id])
      end
      if current_user
        @orders = Order.where(user_id: params[:user_id])
      end
  end
  </code></pre>
  
  <p>OrdersController Spec</p>
  
  <pre><code>require 'rails_helper'
  
  RSpec.describe OrdersController, :type =&gt; :controller do
    describe "unauthorized user" do
      before :each do
        # This simulates an anonymous user
        login_with_user nil
        binding.pry
      end
  
      it "should be redirected back to new user session" do
        get :index
        expect( response ).to redirect_to( new_user_session_path )
      end
    end
  end
  </code></pre>
  
  <p>Routes</p>
  
  <pre><code>resources :users, only: [:index, :show] do
        resources :orders
  end
  </code></pre>
  
  <p>Error</p>
  
  <pre><code>Failures:
  
    1) OrdersController unauthorized user should be redirected back to new user session
       Failure/Error: get :index
  
       ActionController::UrlGenerationError:
         No route matches {:action=&gt;"index", :controller=&gt;"orders"}
  </code></pre>