title: rack-test requires a rack application, but none was given
body: <p>Using Rails, Capybara, Rspec, (and Spring) I'm getting the following error when I run a features spec:</p>
  
  <pre><code>&gt; rspec spec/features/home_page_spec.rb
  </code></pre>
  
  <p>The error:</p>
  
  <pre><code>ArgumentError:
         rack-test requires a rack application, but none was given
       # /Users/Will/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/capybara-2.4.4/lib/capybara/rack_test/driver.rb:16:in `initialize'
       # /Users/Will/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/capybara-2.4.4/lib/capybara.rb:372:in `new'
       # /Users/Will/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/capybara-2.4.4/lib/capybara.rb:372:in `block in &lt;top (required)&gt;'
       # /Users/Will/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/capybara-2.4.4/lib/capybara/session.rb:79:in `call'
       # /Users/Will/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/capybara-2.4.4/lib/capybara/session.rb:79:in `driver'
       # /Users/Will/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/capybara-2.4.4/lib/capybara/session.rb:227:in `visit'
       # /Users/Will/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/capybara-2.4.4/lib/capybara/dsl.rb:51:in `block (2 levels) in &lt;module:DSL&gt;'
       # ./spec/features/home_page_spec.rb:22:in `block (2 levels) in &lt;top (required)&gt;'
  </code></pre>
  
  <p>Example test error:</p>
  
  <pre><code>Randomized with seed 4806
  
  visitor
  
  An error occurred in an after hook
      ArgumentError: rack-test requires a rack application, but none was given
      occurred at /Users/Will/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/capybara-2.4.4/lib/capybara/rack_test/driver.rb:16:in `initialize'
  
    visits homepage (FAILED - 1)
  </code></pre>
  
  <p>So, if it helps, here is my gemfile:</p>
  
  <pre><code>group :development, :test do
    gem 'rspec-rails'
    gem 'factory_girl_rails'
    gem 'faker'
    gem 'capybara'
    gem 'spring',      '1.1.3'
  end
  </code></pre>
  
  <p>spec_helper, if that helps:</p>
  
  <pre><code>require 'devise'
  require 'capybara/rspec'
  
  RSpec.configure do |config|
    config.expect_with :rspec do |expectations|
      expectations.include_chain_clauses_in_custom_matcher_descriptions = true
    end
  
    config.mock_with :rspec do |mocks|
      mocks.verify_partial_doubles = true
    end
  
    config.include Capybara::DSL
  
    config.filter_run :focus
    config.run_all_when_everything_filtered = true
  
    if config.files_to_run.one?
      config.default_formatter = 'doc'
    end
    config.profile_examples = 10
    config.order = :random
  
    Kernel.srand config.seed
  end
  </code></pre>
  
  <p>And my rails_helper:</p>
  
  <pre><code>ENV['RAILS_ENV'] ||= 'test'
  require 'spec_helper'
  require File.expand_path('../../config/environment', __FILE__)
  require 'rspec/rails'
  
  # Add additional requires below this line. Rails is not loaded until this point!
  require 'capybara/rails'
  
  ActiveRecord::Migration.check_pending!
  
  RSpec.configure do |config|
    config.fixture_path = "#{::Rails.root}/spec/fixtures"
  
    config.use_transactional_fixtures = true
    config.include Devise::TestHelpers, :type =&gt; :controller
  
  
    config.infer_spec_type_from_file_location!
  end
  </code></pre>
  
  <p><strong>UPD</strong> home_page_spec.rb:</p>
  
  <pre><code>require 'spec_helper'
  
  feature "visitor" do
  
    # describe 'on desktop' do
  
      scenario 'visits homepage' do
  
        visit '/'
  
        expect(page).to have_content('Drivers')
  
      end
  
      scenario 'visits employer page' do
        visit '/hire'
        expect(page).to have_content('DriverHunt')
      end
  
      scenario 'visits contact page' do
  
        visit '/contact'
  
        expect(page).to have_content('DriverHunt')
  
      end
  
      scenario 'visits terms' do
  
        visit '/terms'
  
        expect(page).to have_content('DriverHunt')
  
      end
  
      scenario 'visits privacy' do
  
        visit '/privacy'
  
        expect(page).to have_content('DriverHunt')
  
      end
  
    # end
  
  
    # describe 'on mobile' do
  
    #   scenario 'visits homepage' do
    #     visit '/?mobile=1'
    #     expect(page).to have_content('Drivers')
    #   end
  
    #   scenario 'visits employer page' do
    #     visit '/hire?mobile=1'
    #     expect(page).to have_content('DriverHunt')
    #   end
  
    #   scenario 'visits contact page' do
  
    #     visit '/contact?mobile=1'
  
    #     expect(page).to have_content('DriverHunt')
  
    #   end
  
    #   scenario 'visits terms' do
  
    #     visit '/terms?mobile=1'
  
    #     expect(page).to have_content('DriverHunt')
  
    #   end
  
    #   scenario 'visits privacy' do
  
    #     visit '/privacy?mobile=1'
  
    #     expect(page).to have_content('DriverHunt')
  
    #   end
  
    # end
  
  
  end
  
  # #   before :each do
  # #     User.make(:email =&gt; 'user@example.com', :password =&gt; 'password')
  # #   end
  
  #   # it "signs me in" do
  # #     visit '/sessions/new'
  # #     within("#session") do
  # #       fill_in 'Email', :with =&gt; 'user@example.com'
  # #       fill_in 'Password', :with =&gt; 'password'
  # #     end
  # #     click_button 'Sign in'
  # #     expect(page).to have_content 'Success'
  # #   end
  
  #   it "finds the homepage" do
  #     visit '/'
  #     expect(page).to have_content 'Driverdasdasd'
  #   end
  </code></pre>