title: Uninitialized constant Capybara
body: <p>I'm having a problem running a test in rails with Capybara. 
  Whenever I run it, it tells me I have an 'uninitialized constant Capybara (NameError)' in my spec_helper.rb file. </p>
  
  <p>I'm following this tutorial: 
  <a href="http://www.railstutorial.org/book/static_pages#code-capybara_dsl" rel="nofollow">http://www.railstutorial.org/book/static_pages#code-capybara_dsl</a></p>
  
  <p>This is my spec_helper.rb</p>
  
  <pre><code>RSpec.configure do |config|
    config.include(Capybara::DSL)
  end
  </code></pre>
  
  <p>and I'm trying to run this test static_pages_spec.rb</p>
  
  <pre><code>require 'spec_helper'
    describe "Static pages" do
  
  it "should have the content 'Sample App'" do
    visit '/static_pages/home'
    expect(page).to have_content('Sample App')
  end 
  </code></pre>
  
  <p>If there is any other more information needed just let me know </p>
  
  <p>--------UPDATE----------------</p>
  
  <p>I figured out the problem. The version of Rspec I have creates a rails_helper.rb file in the spec folder. I had to do:</p>
  
  <pre><code>require 'capybara/rspec'
  </code></pre>
  
  <p>in that file and config.include Capybara::DSL in the configurations. </p>
  
  <p>-----New Problem------------
  But now I get another problem it is saying that 'visit' is undefined. </p>
  
  <pre><code> undefined method `visit' for #&lt;RSpec::ExampleGroups::StaticPages::AboutPage:0x000001033f5d50&gt;
  </code></pre>
  
  <p>I tried require 'capybara', and require 'capybara/dsl' but they all still give me errors and then some. </p>