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

require "spec_helper"

require_migration!

RSpec.describe AddSyncTmpIndexForPotentiallyMisassociatedVulnerabilityOccurrences,
feature_category: :vulnerability_management do
  let(:table) { "vulnerability_occurrences" }
  let(:index) { described_class::INDEX_NAME }

  it "creates and drops the index" do
    reversible_migration do |migration|
      migration.before -> do
        expect(ActiveRecord::Base.connection.indexes(table).map(&:name)).not_to include(index)
      end

      migration.after -> do
        expect(ActiveRecord::Base.connection.indexes(table).map(&:name)).to include(index)
      end
    end
  end
end