diff options
Diffstat (limited to 'spec/requests/api/graphql/mutations/notes/create/note_spec.rb')
-rw-r--r-- | spec/requests/api/graphql/mutations/notes/create/note_spec.rb | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/spec/requests/api/graphql/mutations/notes/create/note_spec.rb b/spec/requests/api/graphql/mutations/notes/create/note_spec.rb index 9c3842db31a..00e25909746 100644 --- a/spec/requests/api/graphql/mutations/notes/create/note_spec.rb +++ b/spec/requests/api/graphql/mutations/notes/create/note_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Adding a Note' do +RSpec.describe 'Adding a Note', feature_category: :team_planning do include GraphqlHelpers let_it_be(:current_user) { create(:user) } @@ -102,6 +102,35 @@ RSpec.describe 'Adding a Note' do it_behaves_like 'a Note mutation with confidential notes' end + + context 'as work item' do + let(:noteable) { create(:work_item, :issue, project: project) } + + context 'when using internal param' do + let(:variables_extra) { { internal: true } } + + it_behaves_like 'a Note mutation with confidential notes' + end + + context 'when using deprecated confidential param' do + let(:variables_extra) { { confidential: true } } + + it_behaves_like 'a Note mutation with confidential notes' + end + + context 'without notes widget' do + let(:variables_extra) { {} } + + before do + stub_const('WorkItems::Type::BASE_TYPES', { issue: { name: 'NoNotesWidget', enum_value: 0 } }) + stub_const('WorkItems::Type::WIDGETS_FOR_TYPE', { issue: [::WorkItems::Widgets::Description] }) + end + + it_behaves_like 'a Note mutation that does not create a Note' + it_behaves_like 'a mutation that returns top-level errors', + errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR] + end + end end context 'when body only contains quick actions' do |