RSpec已弃用

Joh*_*ely 6 rspec deprecated rspec2

我正在进行一些测试,每次运行它时都会收到以下警告:

DEPRECATION WARNING: you are using a deprecated constant that will
be removed from a future version of RSpec.

C:/Sites/injixo/spec/views/me_home_spec.rb:1in 'require'

*Rspec is deprecated
*Rspec is the new top-level module in RSpec-2
Run Code Online (Sandbox Code Playgroud)

我安装了RSpec的最新版本2.6.1,所以我不确定为什么会出现此警告.任何人都可以对这个问题有所了解,以及如何去除它.

谢谢JP

Rob*_*vis 16

问题最有可能发生spec/spec_helper.rb,这可能是您的规范所要求的.现在RSpec使用大写字母S 调用顶级模块.对于您的问题,您必须手动键入一些错误消息,而不是复制并粘贴它.你的spec_helper应该是这样的:

# spec/spec_helper.rb
RSpec.configure do |config|
    ...
end
Run Code Online (Sandbox Code Playgroud)