title: Capybara and Rspec. Capybara not Rendering page in Test, with visit or get method in rails
body: <p>Am a beginner, learning Ruby on Rails and I have an issue getting my test to work. Am using rspec and capybara. The problem is Capybara is not rendering the page or its not getting to the right page. The page opens properly in the browser when I execute: $rails s.
  But when I test with save_and_open_page, the html is empty.</p>
  
  <h2>My Specs</h2>
  
  <p>The following is my first PagesController spec:</p>
  
  <pre><code> require 'spec_helper'
  
  describe PagesController do
  describe "GET 'home'" do
      it "returns http success" do
        visit pages_home_path
        save_and_open_page #at this point it opens the a blank html page
      end
    end
  end
  </code></pre>
  
  <p>My controller spec, this opens a blank page.</p>
  
  <p>I tried an alternative syntax for the Pagescontroller spec:</p>
  
  <pre><code>require 'spec_helper'
  
  describe PagesController do
  
    describe "GET 'home'" do
      it "returns http success" do
         get :home           
         response.should render_template('home')
         response.should have_content("home") #it fails here
       end
    end
  end
  </code></pre>
  
  <p>This shows the following error in the console
  Failures:</p>
  
  <p>1) PagesController GET 'home' returns http success
       Failure/Error: response.should have_content("home")
         expected there to be text "home" in "#"
       # ./spec/controllers/pages_controller_spec.rb:10:in `block (3 levels) in '</p>
  
  <p>Finished in 1.91 seconds
  1 example, 1 failure</p>
  
  <p><strong>Other Configurations:</strong> </p>
  
  <p>In the spec_helper  I have added the following line, the rest is untouched.</p>
  
  <pre><code>require 'capybara/rspec'
  </code></pre>
  
  <p>*<em>Gem file: *</em></p>
  
  <pre><code>    gem 'rails', '3.1.0'
      group :development, :test do
                gem 'autotest-rails'
        gem 'sqlite3'
        gem 'ruby-debug19', :require =&gt; 'ruby-debug'
        gem 'cucumber-rails', :require =&gt; false
        gem 'cucumber-rails-training-wheels'
        gem 'database_cleaner'
        gem 'capybara'
        gem 'launchy'
        gem 'rspec-rails'
        gem 'simplecov'
        gem 'rspec-core', '2.8.0'
      end
      group :assets do
        gem 'therubyracer'              
        gem 'sass-rails', "  ~&gt; 3.1.0"
        gem 'coffee-rails', "~&gt; 3.1.0"
        gem 'uglifier'
      end
  
      gem 'jquery-rails'
      gem 'haml'
  </code></pre>
  
  <p>I have not installed Webrat and verified its not in my Gem list.
  Thank you for your help.</p>