2019-12-01 06:06:11 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-06-17 06:08:43 +00:00
|
|
|
require 'fast_spec_helper'
|
2019-12-01 06:06:11 +00:00
|
|
|
require 'rubocop'
|
|
|
|
require 'rubocop/rspec/support'
|
|
|
|
require_relative '../../../rubocop/cop/ignored_columns'
|
|
|
|
|
2021-01-07 18:10:38 +00:00
|
|
|
RSpec.describe RuboCop::Cop::IgnoredColumns do
|
2019-12-01 06:06:11 +00:00
|
|
|
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
|