title: Rails 4 - Routing the root route to an index action - Rspec Tests Failing
body: <p>I've decided to get back to basics with Rails for a bit and I'm working through thoughtbot's upcase online course.</p>
  
  <p>Here are the tests:</p>
  
  <pre><code>describe "routes" do
    it "routes '/' to the index action of the pages controller" do
      expect(get: "/").to route_to(controller: "pages", action: "index")
    end
  end
  
  describe "root request" do
    it "shows a welcome message" do
      get "/"
      expect(response.body).to include("Welcome to My Guestbook")
    end
  end
  
  describe PagesController do
    describe "#index" do
      it "renders the welcome page" do
        get :index
        expect(response).to render_template("welcome")
      end
    end
  end
  </code></pre>
  
  <p>Here is the output from Rspec:</p>
  
  <pre><code>Failures:
  
    1) PagesController#index renders the welcome page
       Failure/Error: get :index
       ActionController::UrlGenerationError:
         No route matches {:action=&gt;"index", :controller=&gt;"pages"}
       # ./spec/controllers/pages_controller_spec.rb:6:in `block (3 levels) in &lt;top (required)&gt;'
  
    2) routes routes '/' to the index action of the pages controller
       Failure/Error: expect(get: "/").to route_to(controller: "pages", action: "index")
         The recognized options &lt;{"controller"=&gt;"pages", "action"=&gt;"welcome"}&gt; did not match &lt;{"controller"=&gt;"pages", "action"=&gt;"index"}&gt;, difference:.
         --- expected
         +++ actual
         @@ -1 +1 @@
         -{"controller"=&gt;"pages", "action"=&gt;"index"}
         +{"controller"=&gt;"pages", "action"=&gt;"welcome"}
       # ./spec/routing/routes_spec.rb:5:in `block (2 levels) in &lt;top (required)&gt;'
  </code></pre>
  
  <p>My routes:</p>
  
  <pre><code>Rails.application.routes.draw do
    root 'pages#welcome'
  end
  </code></pre>
  
  <p>My controller:</p>
  
  <pre><code>class PagesController &lt; ApplicationController
  
    def index
      render 'pages/welcome'
    end
  
  end
  </code></pre>
  
  <p>I haven't worked with Rspec much, but as far as I can tell the application is doing exactly what the tests want it to.  Any help would be appreciated as I'm some what baffled right now.</p>