Rspec loads routes twice

I’ve been trying to figure this out for a couple of days with no luck.
Searching the Internet doesn’t lead to much. When I run rspec it’s
giving the following error:

add_route': Invalid route name, already in use: 'root' (ArgumentError) You may have defined two routes with the same name using the :asoption, or you may be overriding a route already defined by a resource with the same naming. For the latter, you can restrict the routes created withresources` as explained here:

Here’s my routes.rb file:

App::Application.routes.draw do
root ‘registrations#new’

There are other things in it, but I can comment them all out and still
get the error. Therefore they are not relevant.

spec_helper.rb :

ENV[“RAILS_ENV”] ||= ‘test’
require File.expand_path(“…/…/config/environment”, FILE)
require ‘rspec/rails’
require ‘rspec/autorun’
require ‘capybara/rspec’

Dir[Rails.root.join(“spec/support/**/*.rb”)].each { |f| require f }

Checks for pending migrations before tests are run.

If you are not using ActiveRecord, you can remove this line.

ActiveRecord::Migration.check_pending! if

RSpec.configure do |config|
config.include Helpers

config.fixture_path = “#{::Rails.root}/spec/fixtures”
config.use_transactional_fixtures = true
config.infer_base_class_for_anonymous_controllers = false
config.order = “random”

Part of my Gemfile

group :development, :test do
gem ‘launchy’
gem ‘rspec-rails’, ‘~> 2.0’
gem ‘capybara’, ‘~> 2.1.0’
gem ‘factory_girl_rails’, ‘~> 4.0’

The problem is that Rspec is trying to load routes.rb twice. I tested
this by putting puts “here” in routes.rb file. For the love of Ruby I
cannot figure out why, or how to possibly debug this. When I run rake
routes it only shows one route for root and if I comment it out in
routes.rb, then it does not show. It seems like everything is correct
basically, except that rspec is not working. Also, here’s a similar

, unfortunately I don’t even know if it’s the same problem or not, and
it’s not helping me find a solution. Please help, I’m really stuck on
this one. Any suggestions would be good right now.
I posted this on SO as well, but they might delete it for one of their
bad reasons. So hopefully someone here can help me. Also sorry if all
the spaces, paragraph brakes etc. are collapsed in the final post,
that’s not my fault. :slight_smile: thanks