【发布时间】:2021-04-29 20:33:56
【问题描述】:
我不确定是什么原因造成的,但我的代码中的“应该”一词已被替换为“确实”一词。我正在用 ruby on rails 编写规范,并且正在尝试遵循 BDD 方法进行单元测试。他们的建议之一是将每个单元测试写成一个完整的句子,以“应该”这个词开头,所以我写了以下测试:
it 'should not return if there are no existing activities on the project' do
end
代码被替换为以下内容:
it 'does not return if there are no existing activities on the project' do
end
请注意,“应该”一词已被替换。这是 RuboCop 吗?如果是这样,我禁用了什么规则来防止这种情况发生?
如果不是 RuboCop,那会是什么?
【问题讨论】:
-
should_cleangem 听起来像是一个合理的嫌疑人。尽管 doc 字符串很糟糕,因为一切都返回了 - 即使它返回 nil。
标签: ruby-on-rails visual-studio-code rubocop