summaryrefslogtreecommitdiff
path: root/spec/controllers/projects/notes_controller_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 08:17:02 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 08:17:02 +0000
commitb39512ed755239198a9c294b6a45e65c05900235 (patch)
treed234a3efade1de67c46b9e5a38ce813627726aa7 /spec/controllers/projects/notes_controller_spec.rb
parentd31474cf3b17ece37939d20082b07f6657cc79a9 (diff)
downloadgitlab-ce-b39512ed755239198a9c294b6a45e65c05900235.tar.gz
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'spec/controllers/projects/notes_controller_spec.rb')
-rw-r--r--spec/controllers/projects/notes_controller_spec.rb71
1 files changed, 57 insertions, 14 deletions
diff --git a/spec/controllers/projects/notes_controller_spec.rb b/spec/controllers/projects/notes_controller_spec.rb
index 85e5de46afd..9050765afd6 100644
--- a/spec/controllers/projects/notes_controller_spec.rb
+++ b/spec/controllers/projects/notes_controller_spec.rb
@@ -345,34 +345,77 @@ RSpec.describe Projects::NotesController do
}
end
- context 'when `confidential` parameter is not provided' do
- it 'sets `confidential` to `false` in JSON response' do
+ context 'when parameter is not provided' do
+ it 'sets `confidential` and `internal` to `false` in JSON response' do
create!
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['confidential']).to be false
+ expect(json_response['internal']).to be false
end
end
- context 'when `confidential` parameter is `false`' do
- let(:extra_note_params) { { confidential: false } }
+ context 'when is not a confidential note' do
+ context 'when using the `internal` parameter' do
+ let(:extra_note_params) { { internal: false } }
- it 'sets `confidential` to `false` in JSON response' do
- create!
+ it 'sets `confidential` and `internal` to `false` in JSON response' do
+ create!
- expect(response).to have_gitlab_http_status(:ok)
- expect(json_response['confidential']).to be false
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(json_response['confidential']).to be false
+ expect(json_response['internal']).to be false
+ end
+ end
+
+ context 'when using deprecated `confidential` parameter' do
+ let(:extra_note_params) { { confidential: false } }
+
+ it 'sets `confidential` and `internal` to `false` in JSON response' do
+ create!
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(json_response['confidential']).to be false
+ expect(json_response['internal']).to be false
+ end
end
end
- context 'when `confidential` parameter is `true`' do
- let(:extra_note_params) { { confidential: true } }
+ context 'when is a confidential note' do
+ context 'when using the `internal` parameter' do
+ let(:extra_note_params) { { internal: true } }
- it 'sets `confidential` to `true` in JSON response' do
- create!
+ it 'sets `confidential` and `internal` to `true` in JSON response' do
+ create!
- expect(response).to have_gitlab_http_status(:ok)
- expect(json_response['confidential']).to be true
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(json_response['confidential']).to be true
+ expect(json_response['internal']).to be true
+ end
+ end
+
+ context 'when using deprecated `confidential` parameter' do
+ let(:extra_note_params) { { confidential: true } }
+
+ it 'sets `confidential` and `internal` to `true` in JSON response' do
+ create!
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(json_response['confidential']).to be true
+ expect(json_response['internal']).to be true
+ end
+ end
+
+ context 'when `internal` parameter is `true` and `confidential` parameter is `false`' do
+ let(:extra_note_params) { { internal: true, confidential: false } }
+
+ it 'uses the `internal` param as source of truth' do
+ create!
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(json_response['confidential']).to be true
+ expect(json_response['internal']).to be true
+ end
end
end
end