summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/database/dynamic_model_helpers_spec.rb
blob: 23ad621d0eef9d9690e77e8e2d8ff562f2113bc1 (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::Database::DynamicModelHelpers do
  describe '#define_batchable_model' do
    subject { including_class.new.define_batchable_model(table_name) }

    let(:including_class) { Class.new.include(described_class) }
    let(:table_name) { 'projects' }

    it 'is an ActiveRecord model' do
      expect(subject.ancestors).to include(ActiveRecord::Base)
    end

    it 'includes EachBatch' do
      expect(subject.included_modules).to include(EachBatch)
    end

    it 'has the correct table name' do
      expect(subject.table_name).to eq(table_name)
    end

    it 'has the inheritance type column disable' do
      expect(subject.inheritance_column).to eq('_type_disabled')
    end
  end
end