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:
authorTomasz Maczukin <tomasz@maczukin.pl>2015-12-31 18:56:03 +0300
committerTomasz Maczukin <tomasz@maczukin.pl>2015-12-31 18:56:03 +0300
commit0d014feb1d216e692882976f0d70c3227eaec4ca (patch)
tree235784b5251e437efe88edc86d70ae09b949c2f4 /spec/requests/api
parenta692ce1c079703c4f3947e1d0a29547189e94d0f (diff)
Add delete feature to variables API
Diffstat (limited to 'spec/requests/api')
-rw-r--r--spec/requests/api/variables_spec.rb29
1 files changed, 28 insertions, 1 deletions
diff --git a/spec/requests/api/variables_spec.rb b/spec/requests/api/variables_spec.rb
index 3f58277c4ae..385db2409bd 100644
--- a/spec/requests/api/variables_spec.rb
+++ b/spec/requests/api/variables_spec.rb
@@ -101,11 +101,38 @@ describe API::API, api: true do
end
context 'unauthorized user' do
- it 'should not return project variable details' do
+ it 'should not update variable' do
put api("/projects/#{project.id}/variables/#{variable.id}")
expect(response.status).to eq(401)
end
end
end
+
+ describe 'DELETE /projects/:id/variables/:variable_id' do
+ context 'authorized user with proper permissions' do
+ it 'should delete variable' do
+ expect do
+ delete api("/projects/#{project.id}/variables/#{variable.id}", user)
+ end.to change{project.variables.count}.by(-1)
+ expect(response.status).to eq(200)
+ end
+ end
+
+ context 'authorized user with invalid permissions' do
+ it 'should not delete variable' do
+ delete api("/projects/#{project.id}/variables/#{variable.id}", user2)
+
+ expect(response.status).to eq(403)
+ end
+ end
+
+ context 'unauthorized user' do
+ it 'should not delete variable' do
+ delete api("/projects/#{project.id}/variables/#{variable.id}")
+
+ expect(response.status).to eq(401)
+ end
+ end
+ end
end