diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-15 12:10:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-15 12:10:30 +0300 |
commit | cd5f4619db234c00d0c01ed63bb92df6c10b0fd3 (patch) | |
tree | 09ef12a2231c616d4f747b9d5b83597ae179bb06 /spec/rubocop | |
parent | 024f77efd68833bb78540ff9b4c7b4ec4b9dfe39 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/rubocop')
-rw-r--r-- | spec/rubocop/cop/database/avoid_inheritance_column_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/rubocop/cop/database/avoid_inheritance_column_spec.rb b/spec/rubocop/cop/database/avoid_inheritance_column_spec.rb new file mode 100644 index 00000000000..e009cde8551 --- /dev/null +++ b/spec/rubocop/cop/database/avoid_inheritance_column_spec.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require 'rubocop_spec_helper' +require_relative '../../../../rubocop/cop/database/avoid_inheritance_column' + +RSpec.describe RuboCop::Cop::Database::AvoidInheritanceColumn, feature_category: :shared do + it 'flags when :inheritance_column is used' do + src = <<~SRC + self.inheritance_column = 'some_column' + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not use Single Table Inheritance https://docs.gitlab.com/ee/development/database/single_table_inheritance.html + SRC + + expect_offense(src) + end + + it 'does not flag when :inheritance_column is set to :_type_disabled' do + src = <<~SRC + self.inheritance_column = :_type_disabled + SRC + + expect_no_offenses(src) + end +end |