diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-06-09 17:17:01 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-06-10 13:19:43 +0200 |
commit | beed70c0248fea13bdf727e5f14dee362b0cd298 (patch) | |
tree | 06a8fca1cf4dfcbd60b3dedfd96dda4adf778943 /spec/requests/api/notes_spec.rb | |
parent | d74a8900e27a98f1c921052d2fc44f38cc63a2ea (diff) | |
download | gitlab-ce-feature-flags.tar.gz |
Use feature flags for notes and award emojisfeature-flags
This allows us to disable creating/updating/removing of notes as well as
toggling of award emojis.
Diffstat (limited to 'spec/requests/api/notes_spec.rb')
-rw-r--r-- | spec/requests/api/notes_spec.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/requests/api/notes_spec.rb b/spec/requests/api/notes_spec.rb index beb29a68692..6f4ad308946 100644 --- a/spec/requests/api/notes_spec.rb +++ b/spec/requests/api/notes_spec.rb @@ -266,6 +266,18 @@ describe API::API, api: true do expect(private_issue.notes.reload).to be_empty end end + + context 'when creating notes is disabled' do + it 'responds with a service unavailable error' do + expect(Gitlab::Feature).to receive(:feature_enabled?). + with(:creating_notes). + and_return(false) + + post api("/projects/#{project.id}/issues/#{issue.id}/notes", user), body: 'hi!' + + expect(response.status).to eq(503) + end + end end describe "POST /projects/:id/noteable/:noteable_id/notes to test observer on create" do @@ -334,6 +346,19 @@ describe API::API, api: true do expect(response.status).to eq(404) end end + + context 'when updating notes is disabled' do + it 'responds with a service unavailable error' do + expect(Gitlab::Feature).to receive(:feature_enabled?). + with(:updating_notes). + and_return(false) + + put api("/projects/#{project.id}/issues/#{issue.id}/notes/"\ + "#{issue_note.id}", user), body: 'hi!' + + expect(response.status).to eq(503) + end + end end describe 'DELETE /projects/:id/noteable/:noteable_id/notes/:note_id' do @@ -395,6 +420,19 @@ describe API::API, api: true do expect(response.status).to eq(404) end end + + context 'when deleting notes is disabled' do + it 'responds with a service unavailable error' do + expect(Gitlab::Feature).to receive(:feature_enabled?). + with(:removing_notes). + and_return(false) + + delete api("/projects/#{project.id}/issues/#{issue.id}/notes/"\ + "#{issue_note.id}", user) + + expect(response.status).to eq(503) + end + end end end |