blob: 6d38f7f1b95b58da083702d35f2caafa423b3bcc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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
|