2013-01-14 140 views
1

我試圖使用rails generate運行Ruby on Rails的:使用Rails生成

rails generate integration_test static_pages 

然而,而不是調用RSpec的和規範創建static_pages_spec.rb生成集成測試/請求目錄它顯示我此錯誤:

 
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.10/lib/action_dispatch/routing/mapper.rb:181:in `default_controller_and_action': missing :co 
ntroller (ArgumentError) 
    from 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' 
    from 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' 
    from 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 `block in top (required)>' 
    from 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' 
    from 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' 
    from 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 `' 
    from 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' 
    from 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' 
    from 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' 
    from 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 `block in ' 
    from 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' 
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/initializable.rb:54:in `each' 
    from 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!' 
    from 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 `' 
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/application.rb:103:in `require' 
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/application.rb:103:in `require_environment!' 
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/commands.rb:25:in `' 
    from script/rails:6:in `require' 
    from script/rails:6:in `' 

我該怎麼辦才能解決這個問題?

+0

你是從項目的根目錄做這個嗎? –

+0

感謝您的評論。問題已解決。無法確定究竟發生了什麼問題,但現在似乎正在起作用。 – thepervysage

回答

1

我剛剛有這個完全相同的問題。我在我的routes.rb文件中輸入了root,忘記添加一個參數。我看到同樣的事情發生,如果我把getpost沒有任何參數。

一定要檢查你的路線!