我有一个想要测试的函数,它会在输入时引发异常,但该异常还会携带一些信息,而不仅仅是一条普通的消息,我也想测试一下。所以我做了类似这样的as seen in the rspec documentation it 'raises the correct exception' do
expect { my_callMultipleExpectations cop冲突: RSpec/MultipleExpectations: Example has too many expectations [2/1]
我想通过以下一行将记录中的一列更改为is_deleted: true:但我知道鲁波克的错误:
Rails/skipsmodelvalidations: avoid using update_all because it skips validations我知道我可以使用每个块并在一个块中通过e.update更新所有列,但是update_all
我有一个类似于这个return if amount == 0的方法,rubocop抱怨说它应该像return if amount.zero?。我怎么能让它跳过那个方法?这是我的.rubocop.yml:StringLiterals: Enabled: true
所以基本上我怎么能让它不关心那个特殊的例子呢?
我正在努力实现Rubocop,我在代码库中遇到了一条类似于这条线的代码:
class ThisIsAVerlyLongClassName < JSONAPI::SomeOtherModule::AnotherClassWithAnInsaneNameRubocop抱怨这里的行长,但我想不出一种方法来创建这个类定义的更紧凑的版本,而不重命名类,这正是我在这里试图避免的。在不讨论编码风格的情况下,让Rubo