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

require 'spec_helper'

RSpec.describe Gitlab::Database::Migrations::BaseBackgroundRunner, :freeze_time do
  let(:connection) { ApplicationRecord.connection }

  let(:result_dir) { Dir.mktmpdir }

  after do
    FileUtils.rm_rf(result_dir)
  end

  context 'subclassing' do
    subject { described_class.new(result_dir: result_dir, connection: connection) }

    it 'requires that jobs_by_migration_name be implemented' do
      expect { subject.jobs_by_migration_name }.to raise_error(NotImplementedError)
    end

    it 'requires that run_job be implemented' do
      expect { subject.run_job(nil) }.to raise_error(NotImplementedError)
    end
  end
end