繁体   English   中英

运行控制器的rspec测试时出现Rspec错误

[英]Rspec error when I run my rspec test of my controller

我正在开发Rails v2.3应用程序。

当我通过execute命令运行rspec测试时:

rspec spec/controllers/my_controller_spec.rb

我收到以下显示的错误消息

/.rvm/gems/ruby-1.8.7-p352@myapp/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:427:in `raise_if_rspec_1_is_loaded':  (RuntimeError)
********************************************************************************
  You are running rspec-2, but it seems as though rspec-1 has been loaded as
  well.  This is likely due to a statement like this somewhere in the specs:

      require 'spec'

  Please locate that statement, remove it, and try again.
********************************************************************************
/.rvm/gems/ruby-1.8.7-p352@myapp/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:420:in `load_spec_files'

----更新---

由于它抱怨某些包含代码require 'spec' ,因此我遵循了这一提示,并且在spec / spec_helper.rb中发现了“ require'spec require 'spec' ”, 但是 ,在删除它之后, 仍然出现相同的错误 ,而且我现在没有任何其他文件包含代码。

为什么错误仍然存​​在,真正的原因是什么?

rspecrspec-2的可执行文件。 specrspec-1的可执行文件。 rspec-2rails 2.3不兼容。 您的命令应为:

spec spec/controllers/my_controller_spec.rb

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM