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

20220324032250_migrate_shimo_confluence_service_category_spec.rb « migrations « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 38db6d51e7e396ea2ddfe978ed0240aa8a6e0bbb (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
# frozen_string_literal: true

require 'spec_helper'
require_migration!

RSpec.describe MigrateShimoConfluenceServiceCategory, :migration do
  let(:namespaces) { table(:namespaces) }
  let(:projects) { table(:projects) }
  let(:integrations) { table(:integrations) }

  before do
    namespace = namespaces.create!(name: 'test', path: 'test')
    projects.create!(id: 1, namespace_id: namespace.id, name: 'gitlab', path: 'gitlab')
    integrations.create!(id: 1, active: true, type_new: "Integrations::SlackSlashCommands",
                         category: 'chat', project_id: 1)
    integrations.create!(id: 3, active: true, type_new: "Integrations::Confluence", category: 'common', project_id: 1)
    integrations.create!(id: 5, active: true, type_new: "Integrations::Shimo", category: 'common', project_id: 1)
  end

  describe '#up' do
    it 'correctly schedules background migrations', :aggregate_failures do
      stub_const("#{described_class.name}::BATCH_SIZE", 2)

      Sidekiq::Testing.fake! do
        freeze_time do
          migrate!

          expect(described_class::MIGRATION).to be_scheduled_migration(3, 5)
          expect(BackgroundMigrationWorker.jobs.size).to eq(1)
        end
      end
    end
  end
end