debian-mirror-gitlab/spec/rubocop/cop/ignored_columns_spec.rb

18 lines
522 B
Ruby
Raw Normal View History

2020-01-01 13:55:28 +05:30
# frozen_string_literal: true
2020-07-28 23:09:34 +05:30
require 'fast_spec_helper'
2020-01-01 13:55:28 +05:30
require_relative '../../../rubocop/cop/ignored_columns'
2021-03-08 18:12:59 +05:30
RSpec.describe RuboCop::Cop::IgnoredColumns do
2020-01-01 13:55:28 +05:30
subject(:cop) { described_class.new }
2021-04-17 20:07:23 +05:30
it 'flags direct use of ignored_columns instead of the IgnoredColumns concern' do
expect_offense(<<~RUBY)
2020-01-01 13:55:28 +05:30
class Foo < ApplicationRecord
self.ignored_columns += %i[id]
2021-04-17 20:07:23 +05:30
^^^^^^^^^^^^^^^^^^^^ Use `IgnoredColumns` concern instead of adding to `self.ignored_columns`.
2020-01-01 13:55:28 +05:30
end
RUBY
end
end