Skip to content
代码片段 群组 项目
提交 2da76ef2 编辑于 作者: Dylan Griffith's avatar Dylan Griffith
浏览文件

Fix typo in error message for IgnorableColumns rubocop error

上级 e434c154
No related branches found
No related tags found
无相关合并请求
......@@ -19,8 +19,8 @@ module Cop
# ignore_column :full_name, remove_after: '2023-05-22', remove_with: '16.0'
# end
class IgnoredColumns < RuboCop::Cop::Base
USE_CONCERN_ADD_MSG = 'Use `IgnoredColumns` concern instead of adding to `self.ignored_columns`.'
USE_CONCERN_SET_MSG = 'Use `IgnoredColumns` concern instead of setting `self.ignored_columns`.'
USE_CONCERN_ADD_MSG = 'Use `IgnorableColumns` concern instead of adding to `self.ignored_columns`.'
USE_CONCERN_SET_MSG = 'Use `IgnorableColumns` concern instead of setting `self.ignored_columns`.'
WRONG_MODEL_MSG = <<~MSG
If the model exists in CE and EE, the column has to be ignored
in the CE model. If the model only exists in EE, then it has to be added there.
......
......@@ -4,20 +4,20 @@
require_relative '../../../rubocop/cop/ignored_columns'
RSpec.describe RuboCop::Cop::IgnoredColumns, feature_category: :database do
it 'flags use of `self.ignored_columns +=` instead of the IgnoredColumns concern' do
it 'flags use of `self.ignored_columns +=` instead of the IgnorableColumns concern' do
expect_offense(<<~RUBY)
class Foo < ApplicationRecord
self.ignored_columns += %i[id]
^^^^^^^^^^^^^^^ Use `IgnoredColumns` concern instead of adding to `self.ignored_columns`.
^^^^^^^^^^^^^^^ Use `IgnorableColumns` concern instead of adding to `self.ignored_columns`.
end
RUBY
end
it 'flags use of `self.ignored_columns =` instead of the IgnoredColumns concern' do
it 'flags use of `self.ignored_columns =` instead of the IgnorableColumns concern' do
expect_offense(<<~RUBY)
class Foo < ApplicationRecord
self.ignored_columns = %i[id]
^^^^^^^^^^^^^^^ Use `IgnoredColumns` concern instead of setting `self.ignored_columns`.
^^^^^^^^^^^^^^^ Use `IgnorableColumns` concern instead of setting `self.ignored_columns`.
end
RUBY
end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册