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:
Diffstat (limited to 'spec/requests/api/notes_spec.rb')
-rw-r--r--spec/requests/api/notes_spec.rb47
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