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

hierarchy_restriction_spec.rb « work_items « models « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2c4d5d32fb80129361fc7a93d557c41af53c5da1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe WorkItems::HierarchyRestriction do
  describe 'associations' do
    it { is_expected.to belong_to(:parent_type) }
    it { is_expected.to belong_to(:child_type) }
  end

  describe 'validations' do
    subject { build(:hierarchy_restriction) }

    it { is_expected.to validate_presence_of(:parent_type) }
    it { is_expected.to validate_presence_of(:child_type) }
    it { is_expected.to validate_uniqueness_of(:child_type).scoped_to(:parent_type_id) }
  end
end