summaryrefslogtreecommitdiff
path: root/spec/rubocop/cop
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-01 06:06:11 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-01 06:06:11 +0000
commit864475536355651a9f7caa5b1606aa5640424ec3 (patch)
tree1dc80c96ddf3f9049c4a163b4c49f052a9b1a4ad /spec/rubocop/cop
parent7ddd5846999029916b2b6d8560b5b0f02ec0f6ea (diff)
downloadgitlab-ce-864475536355651a9f7caa5b1606aa5640424ec3.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/rubocop/cop')
-rw-r--r--spec/rubocop/cop/ignored_columns_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/rubocop/cop/ignored_columns_spec.rb b/spec/rubocop/cop/ignored_columns_spec.rb
new file mode 100644
index 00000000000..64437765018
--- /dev/null
+++ b/spec/rubocop/cop/ignored_columns_spec.rb
@@ -0,0 +1,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