summaryrefslogtreecommitdiff
path: root/spec/migrations/20220606082910_add_tmp_index_for_potentially_misassociated_vulnerability_occurrences_spec.rb
blob: 1450811b3b974e5fd83da99b26bbd779bb5d57fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

require "spec_helper"

require_migration!

RSpec.describe AddTmpIndexForPotentiallyMisassociatedVulnerabilityOccurrences do
  let(:async_index) { Gitlab::Database::AsyncIndexes::PostgresAsyncIndex }
  let(:index_name) { described_class::INDEX_NAME }

  it "schedules the index" do
    reversible_migration do |migration|
      migration.before -> do
        expect(async_index.where(name: index_name).count).to be(0)
      end

      migration.after -> do
        expect(async_index.where(name: index_name).count).to be(1)
      end
    end
  end
end