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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-12-19 12:10:52 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-12-19 12:10:52 +0300
commit17295c75a1a28df78f719e0098dd31fe45ce0446 (patch)
tree0544bd2f74e72e45b4a62ff68a4736c26a02a832 /spec/models
parent6c2b987064064500b42da924d86d43473bfd2b7f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/work_items/hierarchy_restriction_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/models/work_items/hierarchy_restriction_spec.rb b/spec/models/work_items/hierarchy_restriction_spec.rb
index 2c4d5d32fb8..890c007b6cd 100644
--- a/spec/models/work_items/hierarchy_restriction_spec.rb
+++ b/spec/models/work_items/hierarchy_restriction_spec.rb
@@ -15,4 +15,24 @@ RSpec.describe WorkItems::HierarchyRestriction do
it { is_expected.to validate_presence_of(:child_type) }
it { is_expected.to validate_uniqueness_of(:child_type).scoped_to(:parent_type_id) }
end
+
+ describe '#clear_parent_type_cache!' do
+ subject(:hierarchy_restriction) { build(:hierarchy_restriction) }
+
+ context 'when a hierarchy restriction is saved' do
+ it 'calls #clear_reactive_cache! on parent type' do
+ expect(hierarchy_restriction.parent_type).to receive(:clear_reactive_cache!).once
+
+ hierarchy_restriction.save!
+ end
+ end
+
+ context 'when a hierarchy restriction is destroyed' do
+ it 'calls #clear_reactive_cache! on parent type' do
+ expect(hierarchy_restriction.parent_type).to receive(:clear_reactive_cache!).once
+
+ hierarchy_restriction.destroy!
+ end
+ end
+ end
end