diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 17:22:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 17:22:11 +0300 |
commit | 0c872e02b2c822e3397515ec324051ff540f0cd5 (patch) | |
tree | ce2fb6ce7030e4dad0f4118d21ab6453e5938cdd /spec/requests/api/notes_spec.rb | |
parent | f7e05a6853b12f02911494c4b3fe53d9540d74fc (diff) |
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'spec/requests/api/notes_spec.rb')
-rw-r--r-- | spec/requests/api/notes_spec.rb | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/spec/requests/api/notes_spec.rb b/spec/requests/api/notes_spec.rb index 89abb28140a..c2d9db1e6fb 100644 --- a/spec/requests/api/notes_spec.rb +++ b/spec/requests/api/notes_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe API::Notes do +RSpec.describe API::Notes, feature_category: :team_planning do let!(:user) { create(:user) } let!(:project) { create(:project, :public) } let(:private_user) { create(:user) } @@ -203,6 +203,51 @@ RSpec.describe API::Notes do end end end + + context 'without notes widget' do + let(:request_body) { 'Hi!' } + let(:params) { { body: request_body } } + let(:request_path) { "/projects/#{ext_proj.id}/issues/#{ext_issue.iid}/notes" } + + 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 'does not fetch notes' do + get api(request_path, private_user) + + expect(response).to have_gitlab_http_status(:not_found) + end + + it 'does not fetch specific note' do + get api("#{request_path}/#{cross_reference_note.id}", private_user) + + expect(response).to have_gitlab_http_status(:not_found) + end + + it 'does not create note' do + post api(request_path, private_user), params: params + + expect(response).to have_gitlab_http_status(:not_found) + end + + it 'does not update note' do + put api("#{request_path}/#{cross_reference_note.id}", private_user), params: params + + expect(response).to have_gitlab_http_status(:not_found) + end + + it 'does not run quick actions' do + params[:body] = "/spend 1h" + + expect do + post api("#{request_path}/#{cross_reference_note.id}", private_user), params: params + end.to not_change { Note.system.count }.and(not_change { Note.where(system: false).count }) + + expect(response).to have_gitlab_http_status(:not_found) + end + end end end |