diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-15 12:11:43 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-15 12:11:43 +0000 |
commit | 14771dc276c9cfdeed1a3915ee29301cd848b475 (patch) | |
tree | 1ce8d34d64cd1c653be9ad3141c8f99ce8c2f2db /spec/controllers/projects/notes_controller_spec.rb | |
parent | 5f431529c8eb0fd5c84df1e66a38ee88b8da1ba6 (diff) | |
download | gitlab-ce-14771dc276c9cfdeed1a3915ee29301cd848b475.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers/projects/notes_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/notes_controller_spec.rb | 71 |
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 |