diff options
author | Peter Leitzen <pleitzen@gitlab.com> | 2019-09-11 19:23:42 +0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-09-11 19:23:42 +0300 |
commit | 50c647af51ae733abb96b84a5169d40b3c8c59be (patch) | |
tree | 13e059a9af8ddad9d1c5d8e312be17629367c9cb /spec/lib/gitlab/database | |
parent | 0abc902576a755355b1daf75e19d1f37c6ffb5ff (diff) |
Add rake task `db:obsolete_ignored_columns`
Show a list of obsolete `ignored_columns`
Diffstat (limited to 'spec/lib/gitlab/database')
-rw-r--r-- | spec/lib/gitlab/database/obsolete_ignored_columns_spec.rb | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/spec/lib/gitlab/database/obsolete_ignored_columns_spec.rb b/spec/lib/gitlab/database/obsolete_ignored_columns_spec.rb new file mode 100644 index 00000000000..6d38f7f1b95 --- /dev/null +++ b/spec/lib/gitlab/database/obsolete_ignored_columns_spec.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Gitlab::Database::ObsoleteIgnoredColumns do + module Testing + class MyBase < ApplicationRecord + end + + class SomeAbstract < MyBase + self.abstract_class = true + + self.table_name = 'projects' + + self.ignored_columns += %i[unused] + end + + class B < MyBase + self.table_name = 'issues' + + self.ignored_columns += %i[id other] + end + + class A < SomeAbstract + self.ignored_columns += %i[id also_unused] + end + + class C < MyBase + self.table_name = 'users' + end + end + + subject { described_class.new(Testing::MyBase) } + + describe '#execute' do + it 'returns a list of class names and columns pairs' do + expect(subject.execute).to eq([ + ['Testing::A', %w(unused also_unused)], + ['Testing::B', %w(other)] + ]) + end + end +end |