title: Michael Hartl's Rails Tutorial Chapter 8.1 Rspec Errors
body: <p>First and foremost I appreciate you all taking the time to review my issue.</p>
  
  <p>I'm a rails rookie working my way through Michael Hartl's Rails Tutorial and I've come about the following error messages when running my Rspec.</p>
  
  <pre><code>1) Authentication with valid information 
       Failure/Error: click_button "Sign in"
       ActionView::MissingTemplate:
         Missing template sessions/create, application/create with {:locale=&gt;[:en], :formats=&gt;[:html], :handlers=&gt;[:erb, :builder, :raw, :ruby, :jbuilder, :coffee]}. Searched in:
           * "/Users/Ladarris/rails_projects/sample_app/app/views"
       # ./spec/requests/authentication_pages_spec.rb:24:in `block (3 levels) in &lt;top (required)&gt;'
  
    2) Authentication with valid information 
       Failure/Error: click_button "Sign in"
       ActionView::MissingTemplate:
         Missing template sessions/create, application/create with {:locale=&gt;[:en], :formats=&gt;[:html], :handlers=&gt;[:erb, :builder, :raw, :ruby, :jbuilder, :coffee]}. Searched in:
           * "/Users/Ladarris/rails_projects/sample_app/app/views"
       # ./spec/requests/authentication_pages_spec.rb:24:in `block (3 levels) in &lt;top (required)&gt;'
  
    3) Authentication with valid information 
       Failure/Error: click_button "Sign in"
       ActionView::MissingTemplate:
         Missing template sessions/create, application/create with {:locale=&gt;[:en], :formats=&gt;[:html], :handlers=&gt;[:erb, :builder, :raw, :ruby, :jbuilder, :coffee]}. Searched in:
           * "/Users/Ladarris/rails_projects/sample_app/app/views"
       # ./spec/requests/authentication_pages_spec.rb:24:in `block (3 levels) in &lt;top (required)&gt;'
  
    4) Authentication with valid information 
       Failure/Error: click_button "Sign in"
       ActionView::MissingTemplate:
         Missing template sessions/create, application/create with {:locale=&gt;[:en], :formats=&gt;[:html], :handlers=&gt;[:erb, :builder, :raw, :ruby, :jbuilder, :coffee]}. Searched in:
           * "/Users/Ladarris/rails_projects/sample_app/app/views"
       # ./spec/requests/authentication_pages_spec.rb:24:in `block (3 levels) in &lt;top (required)&gt;'
  
  Finished in 0.71396 seconds
  42 examples, 4 failures
  </code></pre>
  
  <p><strong>I'm</strong> aware the the error message implies that I am missing <code>app/views/sessions/create.html.erb</code> however its supposed to be looking in <code>app/views/sessions/new.html.erb</code> as stated by the tutorial. </p>
  
  <p>Whenever I go ahead and create a <code>app/views/sessions/create.html.erb</code> the following error messages are returned.</p>
  
  <p>Failures:</p>
  
  <pre><code>1) Authentication with valid information 
       Failure/Error: it { should have_link('Profile',     href: user_path(user), visible: false) }
         expected #has_link?("Profile", {:href=&gt;"/users/1", :visible=&gt;false}) to return true, got false
       # ./spec/requests/authentication_pages_spec.rb:27:in `block (3 levels) in &lt;top (required)&gt;'
  
    2) Authentication with valid information 
       Failure/Error: it { should have_link('Sign out',    href: signout_path) }
         expected #has_link?("Sign out", {:href=&gt;"/signout"}) to return true, got false
       # ./spec/requests/authentication_pages_spec.rb:28:in `block (3 levels) in &lt;top (required)&gt;'
  
    3) Authentication with valid information 
       Failure/Error: it { should have_title(user.name) }
         expected #has_title?("John Smith") to return true, got false
       # ./spec/requests/authentication_pages_spec.rb:26:in `block (3 levels) in &lt;top (required)&gt;'
  </code></pre>
  
  <p><strong>Below are copies of my code.
  <em>_</em>__<em>_</em>__<em>_</em>__<em>_</em>__<em>_</em>__<em>_</em>__<em>_</em></strong></p>
  
  <p><em>Rspec Test</em></p>
  
  <pre><code>require 'spec_helper'
  
  describe "Authentication" do
    subject { page }
    describe "signin page" do
      before { visit signin_path }
      it { should have_content('Sign in') }
      it { should have_title('Sign in') }
    end
    describe "signin" do
        before { visit signin_path }
        describe "with invalid information" do
          before { click_button "Sign in" }
          it { should have_title('Sign in') }
          it { should have_selector('div.alert.alert-error', text: 'Invalid') }
        end
    end
     describe "with valid information" do
            let(:user) { FactoryGirl.create(:user) }
            before do
              visit signin_path
              fill_in "Email",    with: user.email.upcase
              fill_in "Password", with: user.password
              click_button "Sign in"
            end
            it { should have_title(user.name) }
            it { should have_link('Profile',     href: user_path(user), visible: false) }
            it { should have_link('Sign out',    href: signout_path) }
            it { should_not have_link('Sign in', href: signin_path) }
      end
  end
  </code></pre>
  
  <p><em>Sessions Controller</em></p>
  
  <pre><code>class SessionsController &lt; ApplicationController
  
    def new
    end
  
    def create
      user = User.find_by(email: params[:session][:email].downcase)
      if user &amp;&amp; user.authenticate(params[:session][:password])
  
      else
        flash.now[:error] = 'Invalid email/password combination'
        render 'new'
      end
    end
  
    def destroy
    end
  end
  </code></pre>
  
  <p>app/views/session/<em>new.html.erb</em></p>
  
  <pre><code>&lt;% provide(:title, "Sign in") %&gt;
  &lt;h1&gt;Sign in&lt;/h1&gt;
  
  &lt;div class="row"&gt;
    &lt;div class="span6 offset3"&gt;
      &lt;%= form_for(:session, url: sessions_path) do |f| %&gt;
  
        &lt;%= f.label :email %&gt;
        &lt;%= f.text_field :email %&gt;
  
        &lt;%= f.label :password %&gt;
        &lt;%= f.password_field :password %&gt;
  
        &lt;%= f.submit "Sign in", class: "btn btn-large btn-primary" %&gt;
      &lt;% end %&gt;
  
      &lt;p&gt;New user? &lt;%= link_to "Sign up now!", signup_path %&gt;&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><em>routes.rb</em></p>
  
  <pre><code>SampleApp::Application.routes.draw do
    resources :users 
    resources :sessions,      only: [:new, :create, :destroy]
    root to: 'static_pages#home'
    match '/signup',  to: 'users#new',            via: 'get'
    match '/signin',  to: 'sessions#new',         via: 'get'
    match '/signout', to: 'sessions#destroy',     via: 'delete'
    match '/help',    to: 'static_pages#help',    via: 'get'
    match '/about',   to: 'static_pages#about',   via: 'get'
    match '/contact', to: 'static_pages#contact', via: 'get'
  
    # The priority is based upon order of creation: first created -&gt; highest priority.
    # See how all your routes lay out with "rake routes".
  
    # You can have the root of your site routed with "root"
    # root to: 'welcome#index'
  
    # Example of regular route:
    #   get 'products/:id' =&gt; 'catalog#view'
  
    # Example of named route that can be invoked with purchase_url(id: product.id)
    #   get 'products/:id/purchase' =&gt; 'catalog#purchase', as: :purchase
  
    # Example resource route (maps HTTP verbs to controller actions automatically):
    #   resources :products
  
    # Example resource route with options:
    #   resources :products do
    #     member do
    #       get 'short'
    #       post 'toggle'
    #     end
    #
    #     collection do
    #       get 'sold'
    #     end
    #   end
  
    # Example resource route with sub-resources:
    #   resources :products do
    #     resources :comments, :sales
    #     resource :seller
    #   end
  
    # Example resource route with more complex sub-resources:
    #   resources :products do
    #     resources :comments
    #     resources :sales do
    #       get 'recent', on: :collection
    #     end
    #   end
  
    # Example resource route within a namespace:
    #   namespace :admin do
    #     # Directs /admin/products/* to Admin::ProductsController
    #     # (app/controllers/admin/products_controller.rb)
    #     resources :products
    #   end
  end
  </code></pre>