我正在尝试安装 RSpec 以对我没有编写的应用程序进行一些测试。我已经放置
gem "rspec-rails", "~> 2.8"
在我的 gemfile 中并运行 bundle install。这工作得很好。直到我跑
rails 生成 rspec:install
我收到此错误:
/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/whiny_nil.rb:48:in
method_missing': undefined method
to_sym' for nil:NilClass (NoMethodError) from /Users/ anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:1309:inaction_path' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:1304:in
path_for_action' 来自 /Users/anthonyto/.rvm/gems/ruby -1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:1159:inmatch' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:1358:in
match' 来自 /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems /actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:394:inmap_method' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:323:in
get' from /Users/anthonyto/ActiveNetwork/active-trainer/config/routes.rb:447:inblock (4 levels) in <top (required)>' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:565:in
block in controller' from /Users /anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:546: 在scope' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:565:in
控制器'来自 /Users/anthonyto/ActiveNetwork/active-trainer/config/routes.rb:446:inblock (3 levels) in <top (required)>' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:624:in
block in namespace' 来自 /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack- 3.0.20/lib/action_dispatch/routing/mapper.rb:546:inscope' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:624:in
namespace' 来自 /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/ routing/mapper.rb:1119:innamespace' from /Users/anthonyto/ActiveNetwork/active-trainer/config/routes.rb:406:in
block (2 levels) in ' 来自 /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper .rb:624:inblock in namespace' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:546:in
scope' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:624:innamespace' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:1119:in
namespace'来自 /Users/anthonyto/ActiveNetwork/active-trainer/config/routes.rb:405:inblock in <top (required)>' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/route_set.rb:239:in
instance_exec' 来自 /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/route_set.rb:239:indraw' from /Users/anthonyto/ActiveNetwork/active-trainer/config/routes.rb:1:in
' 来自 /Users/anthonyto/。 rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:236:inload' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:236:in
block in load' 来自 /Users/anthonyto/.rvm/gems/ruby-1.9。 3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:225:inblock in load_dependency' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:597:in
new_constants_in' 来自 /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0。 20/lib/active_support/dependencies.rb:225:inload_dependency' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:236:in
load' 来自 /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application.rb: 127:block in reload_routes!' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application.rb:127:in
来自/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application.rb:127: 在reload_routes!' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application.rb:120:in
在 /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/file_update_checker.rb:32:incall' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/file_update_checker.rb:32:in
execute_if_updated' 中阻止 /Users/anthonyto/中的 routes_reloader' .rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application/finisher.rb:51:inblock (2 levels) in <module:Finisher>' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application/finisher.rb:52:in
call' 来自 /Users/anthonyto/.rvm/gems/ruby-1.9 .3-p194/gems/railties-3.0.20/lib/rails/application/finisher.rb:52:inblock in <module:Finisher>' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/initializable.rb:25:in
instance_exec' 来自 /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties -3.0.20/lib/rails/initializable.rb:25:inrun' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/initializable.rb:50:in
block in run_initializers' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails /initializable.rb:49:ineach' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/initializable.rb:49:in
run_initializers' 来自 /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application.rb:134:ininitialize!' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application.rb:77:in
method_missing' 来自 /Users/anthonyto/ActiveNetwork/<top (required)>' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:242:in
来自 /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb 的active-trainer/config/environment.rb:5:in 要求: 242:inblock in require' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:225:in
block in load_dependency' 来自 /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:597:innew_constants_in' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:225:in
load_dependency' 来自 /Users /anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:242:inrequire' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application.rb:103:in
require_environment!来自/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/commands.rb:16:<top (required)>' from script/rails:7:in
需要'来自脚本/rails:7:in `'
我正在运行 ruby 版本 1.9.3 和 rails 版本 3.0.20。我可以提供任何其他信息,任何帮助将不胜感激。谢谢你们!
编辑:当我尝试启动我的 Rails 服务器时,我遇到了同样的错误。似乎我的应用程序存在更深层次的问题。我以前当然没有这个问题,也想不出我所做的任何事情都会导致它。