1

rails generate実行して統合テストを生成するために使用しようとしています

rails generate integration_test static_pages

ただし、rspec を呼び出して static_pages_spec.rb を spec/requests ディレクトリに作成する代わりに、次のエラーが表示されます。

C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.10/lib/action_dispatch/routing/mapper.rb:181:`default_controller_and_action': 欠落 :co
ntroller (ArgumentError)
  C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.10/lib/action_dispatch/routing/mapper.rb:78:in `normalize_options!' より
  from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.10/lib/action_dispatch/routing/mapper.rb:61: in `initialize'
  from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.10/lib/action_dispatch/routing/mapper.rb:1304: in `new'
  from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.10/lib/action_dispatch/routing/mapper.rb:1304:in `add_route'
  C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.10/lib/action_dispatch/routing/mapper.rb:1284:in `decomposed_match' より
  from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.10/lib/action_dispatch/routing/mapper.rb:1270:in `block in match'
  from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.10/lib/action_dispatch/routing/mapper.rb:1270:in `each'
  from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.10/lib/action_dispatch/routing/mapper.rb:1270: in `match'
  C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.10/lib/action_dispatch/routing/mapper.rb:507:in `map_method' より
  from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.10/lib/action_dispatch/routing/mapper.rb:469: in `get'
  from C:/Sites/rails_projects/sample_app/config/routes.rb:2:in `先頭のブロック(必須)>'
  C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.10/lib/action_dispatch/routing/route_set.rb:282:in `instance_exec' から
  C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.10/lib/action_dispatch/routing/route_set.rb:282:in `eval_block' より
  C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.10/lib/action_dispatch/routing/route_set.rb:260:in `draw' から
  from C:/Sites/rails_projects/sample_app/config/routes.rb:1:in `'
  C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.10/lib/active_support/dependencies.rb:245:in `load' から
  from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.10/lib/active_support/dependencies.rb:245:in `block in load'
  C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.10/lib/active_support/dependencies.rb:236:in `load_dependency' から
  C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.10/lib/active_support/dependencies.rb:245:in `load' から
  from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
  from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/application/routes_reloader.rb:40:in `each'
  from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/application/routes_reloader.rb:40:in `load_paths'
  from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/application/routes_reloader.rb:16:in `reload!'
  from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/application/routes_reloader.rb:26:in `block in updater'
  from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.10/lib/active_support/file_update_checker.rb:78:in `call'
  from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.10/lib/active_support/file_update_checker.rb:78: in `execute'
  C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/application/routes_reloader.rb:27:in `updater' より
  from C:in `execute_if_updated' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 0/lib/rails/application/finisher.rb:66:in `ブロックイン '
  C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/initializable.rb:30:in `instance_exec' より
  from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/initializable.rb:30:in `run'
  from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/initializable.rb:55:in `block in run_initializers'
  C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/initializable.rb:54:in `each' より
  C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/initializable.rb:54:in `run_initializers' から
  from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/application.rb:136:in `initialize!'
  C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/railtie/configurable.rb:30:in `method_missing' より
  from C:/Sites/rails_projects/sample_app/config/environment.rb:5:in `'
  C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/application.rb:103から:`require'で
  C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/application.rb:103から:`require_environment!'で
  C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/commands.rb:25:in から
  script/rails:6:in `require' から
  script/rails:6:in `' から

これを解決するにはどうすればよいですか?

4

1 に答える 1

1

これとまったく同じ問題がありました。rootroutes.rb ファイルに入力したのに、引数を追加するのを忘れていました。get引数を入れても入れpostなくても同じことが起こります。

必ずルートを確認してください!

于 2013-01-24T04:17:47.680 に答える