Question

The name of my app is newsample_app . I am following along the railstutorial screencast for upgrading to rails 3.1. Here is the error message I am getting when copying files over from my old "sample_app" to "newsample_app" and trying to run rspec:

rspec spec/controllers/pages_controller_spec.rb /Users/topica/rails_projects/newsample_app/config/routes.rb:1:in `': uninitialized constant NewSampleApp (NameError)

After seeing this, I changed my routes.rb file from my original sample_app from "SampleApp::Application.routes.draw do" to this: "NewSampleApp::Application.routes.draw do" but am still getting the error. Any ideas?

FYI complete error:

Topicas-MacBook-Pro:newsample_app topica$ rspec spec/controllers/pages_controller_spec.rb
/Users/topica/rails_projects/newsample_app/config/routes.rb:1:in `<top (required)>': uninitialized constant NewSampleApp (NameError)
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:29:in `block in load_paths'
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:29:in `each'
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:29:in `load_paths'
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:13:in `reload!'
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:7:in `block in initialize'
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/activesupport-3.1.1/lib/active_support/file_update_checker.rb:32:in `call'
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/activesupport-3.1.1/lib/active_support/file_update_checker.rb:32:in `execute_if_updated'
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/railties-3.1.1/lib/rails/application/finisher.rb:63:in `block (2 levels) in <module:Finisher>'
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/railties-3.1.1/lib/rails/application/finisher.rb:64:in `call'
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/railties-3.1.1/lib/rails/application/finisher.rb:64:in `block in <module:Finisher>'
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `instance_exec'
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `run'
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/railties-3.1.1/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/railties-3.1.1/lib/rails/initializable.rb:54:in `each'
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/railties-3.1.1/lib/rails/initializable.rb:54:in `run_initializers'
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/railties-3.1.1/lib/rails/application.rb:96:in `initialize!'
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/railties-3.1.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /Users/topica/rails_projects/newsample_app/config/environment.rb:5:in `<top (required)>'
    from /Users/topica/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/topica/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/topica/rails_projects/newsample_app/spec/spec_helper.rb:3:in `<top (required)>'
    from /Users/topica/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/topica/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/topica/rails_projects/newsample_app/spec/controllers/pages_controller_spec.rb:1:in `<top (required)>'
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load'
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `block in load_spec_files'
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `map'
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load_spec_files'
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:18:in `run'
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:80:in `run_in_process'
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:69:in `run'
    from /Users/topica/.rvm/gems/ruby-1.9.2-p290@rails3_1tutorial/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:11:in `block in autorun'
Was it helpful?

Solution

You probably want that to match the same as in config/application.rb If it really is newsample_app than it is probably NewsampleApp not NewSampleApp

OTHER TIPS

Looks like a case problem.

> "newsample_app".camelize
 => "NewsampleApp" 

Note the lowercase "s".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top