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

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

require 'spec_helper'
require_migration!

RSpec.describe AddOkrHierarchyRestrictions, :migration, feature_category: :portfolio_management do
  include MigrationHelpers::WorkItemTypesHelper

  let!(:restrictions) { table(:work_item_hierarchy_restrictions) }
  let!(:work_item_types) { table(:work_item_types) }

  it 'creates default restrictions' do
    restrictions.delete_all

    reversible_migration do |migration|
      migration.before -> {
        expect(restrictions.count).to eq(0)
      }

      migration.after -> {
        expect(restrictions.count).to eq(4)
      }
    end
  end

  context 'when work items are missing' do
    before do
      work_item_types.delete_all
    end

    it 'does nothing' do
      expect { migrate! }.not_to change { restrictions.count }
    end
  end
end