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-02-16 15:08:03 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-02-16 15:08:03 +0300
commit12166c0faf75479889bc0ac432b85b9dae91552b (patch)
treefc5a3140e12c815beb6c34d44e2ad423a4f302ad /spec/policies
parentb1a0a71628cb4531f3b9a2999f5aa4d22f6ac5fb (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/policies')
-rw-r--r--spec/policies/issue_policy_spec.rb16
-rw-r--r--spec/policies/note_policy_spec.rb4
2 files changed, 7 insertions, 13 deletions
diff --git a/spec/policies/issue_policy_spec.rb b/spec/policies/issue_policy_spec.rb
index 0040d9dff7e..17558787966 100644
--- a/spec/policies/issue_policy_spec.rb
+++ b/spec/policies/issue_policy_spec.rb
@@ -425,19 +425,15 @@ RSpec.describe IssuePolicy, feature_category: :team_planning do
context 'when accounting for notes widget' do
let(:policy) { described_class.new(reporter, note) }
- before do
- widgets_per_type = WorkItems::Type::WIDGETS_FOR_TYPE.dup
- widgets_per_type[:task] = [::WorkItems::Widgets::Description]
- stub_const('WorkItems::Type::WIDGETS_FOR_TYPE', widgets_per_type)
- end
-
- context 'and notes widget is disabled for task' do
- let(:task) { create(:work_item, :task, project: project) }
+ context 'and notes widget is disabled for issue' do
+ before do
+ WorkItems::Type.default_by_type(:issue).widget_definitions.find_by_widget_type(:notes).update!(disabled: true)
+ end
it 'does not allow accessing notes' do
# if notes widget is disabled not even maintainer can access notes
- expect(permissions(maintainer, task)).to be_disallowed(:create_note, :read_note, :mark_note_as_internal, :read_internal_note)
- expect(permissions(admin, task)).to be_disallowed(:create_note, :read_note, :read_internal_note, :mark_note_as_internal, :set_note_created_at)
+ expect(permissions(maintainer, issue)).to be_disallowed(:create_note, :read_note, :mark_note_as_internal, :read_internal_note)
+ expect(permissions(admin, issue)).to be_disallowed(:create_note, :read_note, :read_internal_note, :mark_note_as_internal, :set_note_created_at)
end
end
diff --git a/spec/policies/note_policy_spec.rb b/spec/policies/note_policy_spec.rb
index f4abe3a223c..b2191e6925d 100644
--- a/spec/policies/note_policy_spec.rb
+++ b/spec/policies/note_policy_spec.rb
@@ -260,9 +260,7 @@ RSpec.describe NotePolicy, feature_category: :team_planning do
let(:policy) { described_class.new(developer, note) }
before do
- widgets_per_type = WorkItems::Type::WIDGETS_FOR_TYPE.dup
- widgets_per_type[:task] = [::WorkItems::Widgets::Description]
- stub_const('WorkItems::Type::WIDGETS_FOR_TYPE', widgets_per_type)
+ WorkItems::Type.default_by_type(:task).widget_definitions.find_by_widget_type(:notes).update!(disabled: true)
end
context 'when noteable is task' do