Ruby on rails Rspec/DescribeClass上的Rubocop错误
由于previos版本中的一个错误,我最近更新到了Rubocop的最新版本(0.51),但现在它将以下内容标记为错误:Ruby on rails Rspec/DescribeClass上的Rubocop错误,ruby-on-rails,rspec,rubocop,rubocop-rspec,Ruby On Rails,Rspec,Rubocop,Rubocop Rspec,由于previos版本中的一个错误,我最近更新到了Rubocop的最新版本(0.51),但现在它将以下内容标记为错误: spec/controllers/loans_controller_spec.rb:3:10: C: RSpec/DescribeClass: The first argument to describe should be the class or module being tested. describe LoansController do ^^^^^^
spec/controllers/loans_controller_spec.rb:3:10: C: RSpec/DescribeClass: The first argument to describe should be the class or module being tested.
describe LoansController do
^^^^^^^^^^^^^^^
这是我一直以来的做法,事实上,这是我想测试的课程
我的等级库文件夹中的所有文件也是如此。它们都有相应的类名。您必须指定您正在测试的类是控制器,在引用该类之后,您必须指定它是什么类型的类。在您的情况下,它将是
:type=>:controller
例如:
RSpec.describe LoansController, :type => :controller do
end
有关更多信息,请访问以下链接我已通过更新rubocop rspec版本修复了错误
它是1.10版,并更新为1.20.1。错误没有再次显示。听起来好像该通用原则被打破了。我暂时跳过它,在github上提出一个问题。rspec COP也是由核心Rubocp gem提供的,而不是核心Rubocp gem。最新版本是1.20.1。我也有最新版本的rubocop rspec。我想我会暂时忽略它,我无法复制它。该示例是否省略了其他代码?我似乎弄错了,rubocop rspec版本不是最后一个。