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

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

require 'spec_helper'

RSpec.describe Gitlab::Database::AsyncConstraints, feature_category: :database do
  describe '.validate_pending_entries!' do
    subject { described_class.validate_pending_entries! }

    let!(:fk_validation) do
      create(:postgres_async_constraint_validation, :foreign_key, attempts: 2)
    end

    let(:check_validation) do
      create(:postgres_async_constraint_validation, :check_constraint, attempts: 1)
    end

    it 'executes pending validations' do
      expect_next_instance_of(described_class::Validators::ForeignKey, fk_validation) do |validator|
        expect(validator).to receive(:perform)
      end

      expect_next_instance_of(described_class::Validators::CheckConstraint, check_validation) do |validator|
        expect(validator).to receive(:perform)
      end

      subject
    end
  end
end