2019-12-01 01:06:11 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-06-17 02:08:43 -04:00
|
|
|
require 'fast_spec_helper'
|
2019-12-01 01:06:11 -05:00
|
|
|
require 'rubocop'
|
|
|
|
require 'rubocop/rspec/support'
|
|
|
|
require_relative '../../../rubocop/cop/ignored_columns'
|
|
|
|
|
2020-06-24 02:09:01 -04:00
|
|
|
RSpec.describe RuboCop::Cop::IgnoredColumns, type: :rubocop do
|
2019-12-01 01:06:11 -05: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
|