Answer the question
In order to leave comments, you need to log in
Why does rspec duplicate the calls to routes.rb?
The rest of the application works fine, but the problem appeared with the advent of Capybara. But now removing the capybara does not help. The error remains(
Now, when rspec is called, there is an explicit double attempt to execute routes.rb:
$ bundle exec rspec
--- here ---
--- here ---
/Users/svetozar/.rvm/gems/[email protected]_rails_4_0/gems/actionpack-4.2.4/lib/action_dispatch/routing/route_set.rb:557:in `add_route': Invalid route name, already in use: 'root' (ArgumentError)
You may have defined two routes with the same name using the `:as` option, 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 with `resources` as explained here:
http://guides..org/routing.html#restricting-the-routes-created
from /Users/svetozar/.rvm/gems/[email protected]_rails_4_0/gems/actionpack-4.2.4/lib/action_dispatch/routing/mapper.rb:1561:in `add_route'
from /Users/svetozar/.rvm/gems/[email protected]_rails_4_0/gems/actionpack-4.2.4/lib/action_dispatch/routing/mapper.rb:1536:in `decomposed_match'
from /Users/svetozar/.rvm/gems/[email protected]_rails_4_0/gems/actionpack-4.2.4/lib/action_dispatch/routing/mapper.rb:1517:in `block in match'
from /Users/svetozar/.rvm/gems/[email protected]_rails_4_0/gems/actionpack-4.2.4/lib/action_dispatch/routing/mapper.rb:1507:in `each'
from /Users/svetozar/.rvm/gems/[email protected]_rails_4_0/gems/actionpack-4.2.4/lib/action_dispatch/routing/mapper.rb:1507:in `match'
и т.д. ...
Rails.application.routes.draw do
puts "--- here ---"
### ГЛАВНОЕ
root 'service#home'
# ...
rails s -e test
does not generate any errors. Also, calling the same versions of Capybara and Rspec on a nearby test project doesn't throw any errors... source 'http://rubygems.org'
gem 'rails', '4.2.4'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'bcrypt-ruby', '~> 3.1', '>= 3.1.5'
gem 'tzinfo-data', platforms: [:mingw, :mswin]
gem 'haml'
gem 'bootstrap-sass'
gem 'devise'
gem 'cancancan'
gem 'rolify'
gem 'russian'
gem 'ancestry'
gem 'paperclip' #, : 'thoughtbot/paperclip'
gem 'activerecord-session_store' #, : 'rails/activerecord-session_store'
gem 'will_paginate', '~> 3.1'
# поиск
gem 'sunspot_rails'
gem 'date_diff'
# фоновые задачи
gem 'redis-namespace'
gem 'sidekiq', '~> 4.1'
gem 'sidekiq-status'
gem 'sidekiq_mailer'
gem 'sinatra', require: false
group :production do
gem 'mysql2', '~> 0.3.20'
gem 'therubyracer', platform: :ruby
gem 'execjs'
end
group :development do
gem 'capistrano-rails'
gem 'capistrano-rvm'
gem 'capistrano-passenger'
gem 'capistrano-bundler'
gem 'capistrano-sidekiq'
gem 'progress_bar'
gem 'better_errors'
gem 'binding_of_caller'
end
group :development, :test do
gem 'sunspot_solr'
gem 'puma'
end
group :test do
gem 'rspec-rails', '~> 3.4', '>= 3.4.2'
gem 'factory_girl_rails', '~> 4.5'
gem 'capybara', '~> 2.5'
end
Answer the question
In order to leave comments, you need to log in
Check if it is written somewhere that
it reloads routes while the application is running. Although even so, if you don't have duplicates in your routes, you shouldn't swear...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question