summaryrefslogtreecommitdiff
path: root/spec/rubocop/cop/ignored_columns_spec.rb
blob: 1c72fedbf3140ea133513ea8368d38bfa33fbba1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

require 'fast_spec_helper'
require_relative '../../../rubocop/cop/ignored_columns'

RSpec.describe RuboCop::Cop::IgnoredColumns do
  subject(:cop) { described_class.new }

  it 'flags direct use of ignored_columns instead of the IgnoredColumns concern' do
    expect_offense(<<~RUBY)
      class Foo < ApplicationRecord
        self.ignored_columns += %i[id]
        ^^^^^^^^^^^^^^^^^^^^ Use `IgnoredColumns` concern instead of adding to `self.ignored_columns`.
      end
    RUBY
  end
end