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

20220601110011_schedule_remove_self_managed_wiki_notes_spec.rb « migrations « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 44e80980b27f25e388f6aab0b67399d09e3e84b0 (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'
require_migration!

RSpec.describe ScheduleRemoveSelfManagedWikiNotes do
  let_it_be(:batched_migration) { described_class::MIGRATION }

  it 'schedules new batched migration' do
    reversible_migration do |migration|
      migration.before -> {
        expect(batched_migration).not_to have_scheduled_batched_migration
      }

      migration.after -> {
        expect(batched_migration).to have_scheduled_batched_migration(
          table_name: :notes,
          column_name: :id,
          interval: described_class::INTERVAL
        )
      }
    end
  end

  context 'with com? or staging?' do
    before do
      allow(::Gitlab).to receive(:com?).and_return(true)
      allow(::Gitlab).to receive(:staging?).and_return(false)
    end

    it 'does not schedule new batched migration' do
      reversible_migration do |migration|
        migration.before -> {
          expect(batched_migration).not_to have_scheduled_batched_migration
        }

        migration.after -> {
          expect(batched_migration).not_to have_scheduled_batched_migration
        }
      end
    end
  end
end