2011-10-19 4 views
0

私のアプリの名前はnewsample_appです。私はrailstutorialスクリーンキャストに沿ってレール3.1にアップグレードしています。ここで「newsample_app」に私の昔の「sample_app」からファイルを超えるコピーしてRSpecの実行しようとしたとき、私は取得していますエラーメッセージです:アプリをレールにアップグレードするときにNameErrorを取得する3.1.1

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

これを見た後、私は私のオリジナルsample_appから私のroutes.rbをファイルを変更しました"SampleApp :: Application.routes.draw do"から "NewSampleApp :: Application.routes.draw do"に変更しましたが、まだエラーが発生しています。何か案は?

FYI完全なエラー:

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/[email protected]_1tutorial/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:29:in `block in load_paths' 
    from /Users/topica/.rvm/gems/[email protected]_1tutorial/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:29:in `each' 
    from /Users/topica/.rvm/gems/[email protected]_1tutorial/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:29:in `load_paths' 
    from /Users/topica/.rvm/gems/[email protected]_1tutorial/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:13:in `reload!' 
    from /Users/topica/.rvm/gems/[email protected]_1tutorial/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:7:in `block in initialize' 
    from /Users/topica/.rvm/gems/[email protected]_1tutorial/gems/activesupport-3.1.1/lib/active_support/file_update_checker.rb:32:in `call' 
    from /Users/topica/.rvm/gems/[email protected]_1tutorial/gems/activesupport-3.1.1/lib/active_support/file_update_checker.rb:32:in `execute_if_updated' 
    from /Users/topica/.rvm/gems/[email protected]_1tutorial/gems/railties-3.1.1/lib/rails/application/finisher.rb:63:in `block (2 levels) in <module:Finisher>' 
    from /Users/topica/.rvm/gems/[email protected]_1tutorial/gems/railties-3.1.1/lib/rails/application/finisher.rb:64:in `call' 
    from /Users/topica/.rvm/gems/[email protected]_1tutorial/gems/railties-3.1.1/lib/rails/application/finisher.rb:64:in `block in <module:Finisher>' 
    from /Users/topica/.rvm/gems/[email protected]_1tutorial/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `instance_exec' 
    from /Users/topica/.rvm/gems/[email protected]_1tutorial/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `run' 
    from /Users/topica/.rvm/gems/[email protected]_1tutorial/gems/railties-3.1.1/lib/rails/initializable.rb:55:in `block in run_initializers' 
    from /Users/topica/.rvm/gems/[email protected]_1tutorial/gems/railties-3.1.1/lib/rails/initializable.rb:54:in `each' 
    from /Users/topica/.rvm/gems/[email protected]_1tutorial/gems/railties-3.1.1/lib/rails/initializable.rb:54:in `run_initializers' 
    from /Users/topica/.rvm/gems/[email protected]_1tutorial/gems/railties-3.1.1/lib/rails/application.rb:96:in `initialize!' 
    from /Users/topica/.rvm/gems/[email protected]_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/[email protected]_1tutorial/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load' 
    from /Users/topica/.rvm/gems/[email protected]_1tutorial/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `block in load_spec_files' 
    from /Users/topica/.rvm/gems/[email protected]_1tutorial/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `map' 
    from /Users/topica/.rvm/gems/[email protected]_1tutorial/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load_spec_files' 
    from /Users/topica/.rvm/gems/[email protected]_1tutorial/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:18:in `run' 
    from /Users/topica/.rvm/gems/[email protected]_1tutorial/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:80:in `run_in_process' 
    from /Users/topica/.rvm/gems/[email protected]_1tutorial/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:69:in `run' 
    from /Users/topica/.rvm/gems/[email protected]_1tutorial/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:11:in `block in autorun' 

答えて

1

それは本当にそれはおそらくNewsampleAppあるよりnewsample_appされていない場合は、おそらくそれはのconfig/application.rb と同じに一致するようにしたいNewSampleApp

+0

いやはや! jdlそれに私を打つ – house9

+0

ああ男。どちらも正しい。次回は、.camelizeのためにirbにまっすぐ行くつもりです。助けてくれてありがとう、もう一度この間違いをしないだろう:) – kcurtin

+0

@ house9近くだったと思う。私は努力のためにあなたに+1を投げた。 – jdl

1

は、ケースの問題のように見えます。

> "newsample_app".camelize 
=> "NewsampleApp" 

小文字の「s」に注意してください。

関連する問題