Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dump_schema_versions_mixin_spec.rb « postgresql_adapter « database « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ca9f4af918760aab36fb750a4149565cc1cb7b12 (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::Database::PostgresqlAdapter::DumpSchemaVersionsMixin do
  let(:schema_migration) { double('schema_migration', all_versions: versions) }

  let(:instance) do
    Object.new.extend(described_class)
  end

  before do
    allow(instance).to receive(:schema_migration).and_return(schema_migration)
  end

  context 'when version files exist' do
    let(:versions) { %w(5 2 1000 200 4 93 2) }

    it 'touches version files' do
      expect(Gitlab::Database::SchemaVersionFiles).to receive(:touch_all).with(versions)

      instance.dump_schema_information
    end
  end

  context 'when version files do not exist' do
    let(:versions) { [] }

    it 'does not touch version files' do
      expect(Gitlab::Database::SchemaVersionFiles).not_to receive(:touch_all)

      instance.dump_schema_information
    end
  end
end