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

require 'spec_helper'
require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../rubocop/cop/ignored_columns'

describe RuboCop::Cop::IgnoredColumns do
  include CopHelper

  subject(:cop) { described_class.new }

  it 'flags the use of destroy_all with a local variable receiver' do
    inspect_source(<<~RUBY)
      class Foo < ApplicationRecord
        self.ignored_columns += %i[id]
      end
    RUBY

    expect(cop.offenses.size).to eq(1)
  end
end