Я просматриваю учебник Hartl для рельсов и сталкиваюсь с дорожным блоком, которого я не могу понять. Я первый шаг к созданию теста интеграции (Rspec). Я вошел:Не удается найти static_pages_spec.rb в каталоге spec/requests
rails generate integration_test static_pages
, а затем получил
Waymond-MacBook-Pro:sample_app wayway$ rails generate integration_test static_pages
/Library/Ruby/Gems/2.0.0/gems/actionpack-4.0.1/lib/action_dispatch/routing/mapper.rb:229:in `default_controller_and_action': missing :controller (ArgumentError)
from /Library/Ruby/Gems/2.0.0/gems/actionpack-4.0.1/lib/action_dispatch/routing/mapper.rb:116:in `normalize_options!'
from /Library/Ruby/Gems/2.0.0/gems/actionpack-4.0.1/lib/action_dispatch/routing/mapper.rb:64:in `initialize'
from /Library/Ruby/Gems/2.0.0/gems/actionpack-4.0.1/lib/action_dispatch/routing/mapper.rb:1443:in `new'
from /Library/Ruby/Gems/2.0.0/gems/actionpack-4.0.1/lib/action_dispatch/routing/mapper.rb:1443:in `add_route'
from /Library/Ruby/Gems/2.0.0/gems/actionpack-4.0.1/lib/action_dispatch/routing/mapper.rb:1422:in `decomposed_match'
from /Library/Ruby/Gems/2.0.0/gems/actionpack-4.0.1/lib/action_dispatch/routing/mapper.rb:1403:in `block in match'
from /Library/Ruby/Gems/2.0.0/gems/actionpack-4.0.1/lib/action_dispatch/routing/mapper.rb:1394:in `each'
from /Library/Ruby/Gems/2.0.0/gems/actionpack-4.0.1/lib/action_dispatch/routing/mapper.rb:1394:in `match'
from /Library/Ruby/Gems/2.0.0/gems/actionpack-4.0.1/lib/action_dispatch/routing/mapper.rb:601:in `map_method'
from /Library/Ruby/Gems/2.0.0/gems/actionpack-4.0.1/lib/action_dispatch/routing/mapper.rb:562:in `get'
from /Users/waystylez1/rails_projects/sample_app/config/routes.rb:2:in `block in <top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/actionpack-4.0.1/lib/action_dispatch/routing/route_set.rb:341:in `instance_exec'
from /Library/Ruby/Gems/2.0.0/gems/actionpack-4.0.1/lib/action_dispatch/routing/route_set.rb:341:in `eval_block'
from /Library/Ruby/Gems/2.0.0/gems/actionpack-4.0.1/lib/action_dispatch/routing/route_set.rb:319:in `draw'
from /Users/waystylez1/rails_projects/sample_app/config/routes.rb:1:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:223:in `load'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:223:in `block in load'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:214:in `load_dependency'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:223:in `load'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.1/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.1/lib/rails/application/routes_reloader.rb:40:in `each'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.1/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.1/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.1/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.0.1/lib/active_support/file_update_checker.rb:75:in `call'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.0.1/lib/active_support/file_update_checker.rb:75:in `execute'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.1/lib/rails/application/routes_reloader.rb:27:in `updater'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.1/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.1/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.1/lib/rails/initializable.rb:30:in `instance_exec'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.1/lib/rails/initializable.rb:30:in `run'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.1/lib/rails/initializable.rb:55:in `block in run_initializers'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:180:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.1/lib/rails/initializable.rb:54:in `run_initializers'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.1/lib/rails/application.rb:215:in `initialize!'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/waystylez1/rails_projects/sample_app/config/environment.rb:5:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.1/lib/rails/application.rb:189:in `require'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.1/lib/rails/application.rb:189:in `require_environment!'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.1/lib/rails/commands.rb:44:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
и должен был получить static_pages_spec.rb в спецификации/запрашивает каталог. Это не там, поэтому я предполагаю, что моя маршрутизация неверна? Любая помощь приветствуется! Благодаря!
Редактировать. это от конфигурации/routes.rb
SampleApp::Application.routes.draw do
get "static_pages/..."
get "static_pages/home"
get "static_pages/help"
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
Вы можете вставить весь файл маршрутов? – jvnill
Не уверен, что это правильная информация о маршруте, которую вы запрашиваете. Извините, я ноб. – Waymond
Вы должны опубликовать все содержимое 'config/routes.rb'. Вот где вы получаете свою ошибку. –