1
votes

I am trying to use rails generate to generate an integration test by running

rails generate integration_test static_pages

However, instead of invoking rspec and creating static_pages_spec.rb in the spec/requests directory it shows me this error:

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 `'

What can I do to remedy this?

1
Are you doing this from the root directory of the project?Michael Durrant
Thanks for the comment. The issue has been resolved. Can't pinpoint what exactly went wrong but it seems to be working now.thepervysage

1 Answers

1
votes

I just had this exact same issue. I had typed root into my routes.rb file and forgot to add an argument. I see the same thing happens if I put get or post without any arguments.

Make sure to check your routes!