title: Ruby on Rails Tutorial by Michael Hartl Chapter 7.1.3 - Failing Test
body: <p>I've spent a couple hours trying to figure out this tiny little piece of the puzzle before moving on in the tutorial so it doesn't blow up on my later.  Because of that, I know issues where tests are failing like these are a dime a dozen, so I apologize. In the "7.1.3 Testing the user show page (with factories)" section of the tutorial (link provided below), I cannot get the signup page tests to pass.  This seems like it's so trivial, but I can't find anything wrong in any of the seemingly endless files where there could be an issue (the controller, routes, the test itself, the user model, and so on).   No one online seems to have had this issue either, so I figure it's got to be some random setting or something on my rails project.</p>
  
  <p>Anyway, here is what I believe is the relevant code:<br />
  <b>The error from running the user_pages_spec test in sublime:</b></p>
  
  <pre><code>Failures:
  
    1) User pages signup page 
       Failure/Error: it { should have_content('Sign up') }
         expected #has_content?("Sign up") to return true, got false
       # ./spec/requests/user_pages_spec.rb:18:in `block (3 levels) in &lt;top (required)&gt;'
  
    2) User pages signup page 
       Failure/Error: it { should have_title(full_title('Sign up')) }
         expected #has_title?("Ruby on Rails Tutorial Sample App | Sign up") to return true, got false
       # ./spec/requests/user_pages_spec.rb:19:in `block (3 levels) in &lt;top (required)&gt;'
  
  Finished in 0.16194 seconds
  4 examples, 2 failures
  
  Failed examples:
  
  rspec ./spec/requests/user_pages_spec.rb:18 # User pages signup page 
  rspec ./spec/requests/user_pages_spec.rb:19 # User pages signup page 
  
  Randomized with seed 46255
  
  [Finished in 2.7s with exit code 1]
  </code></pre>
  
  <p><b>spec/requests/user_pages_spec.rb</b> <br /></p>
  
  <pre><code>require 'spec_helper'
  
  describe "User pages" do
  
    subject { page }
  
    describe "profile page" do
      let(:user) { FactoryGirl.create(:user) }
      before { visit user_path(user) }
  
      it { should have_content(user.name) }
      it { should have_title(user.name) }
    end
  
    describe "signup page" do
      before { visit signup_path }
  
      it { should have_content('Sign up') }
      it { should have_title(full_title('Sign up')) }
    end
  end
  </code></pre>
  
  <p><b>app/views/users/new.html.erb</b></p>
  
  <pre><code>&lt;% provide(:title, 'Sign Up') %&gt;
  &lt;h1&gt;Sign Up&lt;/h1&gt;
  &lt;p&gt;Find me in app/views/users/new.html.erb&lt;/p&gt;
  </code></pre>
  
  <p><b>app/controller/users_controller.rb</b> <br /></p>
  
  <pre><code>class UsersController &lt; ApplicationController
  
    def show
      @user = User.find(params[:id])
    end
  
    def new
    end
  end
  </code></pre>
  
  <p><b>config/routes.rb</b> <br /></p>
  
  <pre><code>SampleApp::Application.routes.draw do
    resources :users
    root to: 'static_pages#home'
    match '/signup',  to: 'users#new',            via: 'get'
    match '/help',    to: 'static_pages#help',    via: 'get'
    match '/about',   to: 'static_pages#about',   via: 'get'
    match '/contact', to: 'static_pages#contact', via: 'get'
  end
  </code></pre>
  
  <p>Let me know if you can think of any other code you may need to see.  I included new.html.erb because <em>I think</em> that the signup test is looking on that page, but I must be wrong on that.  If anyone could let me know what I'm doing wrong that is causing this failure, I would be eternally grateful.  </p>
  
  <p>If you could convince me that the whole test driven development concept isn't a complete pain in the rear, then you could get some extra brownie points on top of that.  I've found this tutorial to be pretty enjoyable, but any time I get to a testing section I lose all motivation to continue, especially when it doesn't work.  I know it's better for your code in the long run, but for just getting started I'm beginning to think I should just ignore it at risk of quitting.</p>
  
  <p><a href="http://ruby.railstutorial.org/book/ruby-on-rails-tutorial?version=4.0#code-name_title_and_heading" rel="nofollow">http://ruby.railstutorial.org/book/ruby-on-rails-tutorial?version=4.0#code-name_title_and_heading</a></p>