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

20220819153725_add_vulnerability_advisory_foreign_key_to_sbom_vulnerable_component_versions_spec.rb « migrations « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c53dd9de649c8ff0d3ca945a9164e75cd0bd6554 (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 AddVulnerabilityAdvisoryForeignKeyToSbomVulnerableComponentVersions do
  let(:table) { described_class::SOURCE_TABLE }
  let(:column) { described_class::COLUMN }
  let(:foreign_key) { -> { described_class.new.foreign_keys_for(table, column).first } }

  it "creates and drops the foreign key" do
    reversible_migration do |migration|
      migration.before -> do
        expect(foreign_key.call).to be(nil)
      end

      migration.after -> do
        expect(foreign_key.call).to have_attributes(column: column.to_s)
      end
    end
  end
end