uninitialized constant Capybara (NameError) in rails app

You have to add config.include Capybara::DSL to rails_helper.rb, and not into spec_helper.rb. It worked for me perfectly!


I think this could work. Try adding these lines in spec_helper.rb

RSpec.configure do |config|
 config.fixture_path = "#{::Rails.root}/spec/fixtures"
 config.use_transactional_fixtures = true
 config.infer_base_class_for_anonymous_controllers = false
 config.order = "random" 
 config.include Capybara::DSL
end

Did you already run bundle install? Have you added

require 'capybara/rails' 

in rails_helper.rb

If you are using Capybara you might want to follow the instructions here.