summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2015-12-31 17:03:11 +0100
committerTomasz Maczukin <tomasz@maczukin.pl>2015-12-31 17:03:11 +0100
commitc5177dd5e2171b047a695802c979cf779522ba8a (patch)
tree2ef3b8c8c301625effe4a7690c8949d1ee2fb95b /spec
parent0d014feb1d216e692882976f0d70c3227eaec4ca (diff)
downloadgitlab-ce-c5177dd5e2171b047a695802c979cf779522ba8a.tar.gz
Add missing 'not_found' checks in variables API
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/api/variables_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/requests/api/variables_spec.rb b/spec/requests/api/variables_spec.rb
index 385db2409bd..b35ee2d32d1 100644
--- a/spec/requests/api/variables_spec.rb
+++ b/spec/requests/api/variables_spec.rb
@@ -54,6 +54,12 @@ describe API::API, api: true do
expect(json_response['id']).to eq(variable.id)
expect(json_response['value']).to eq(variable.value)
end
+
+ it 'should responde with 404 Not Found if requesting non-existing variable' do
+ get api("/projects/#{project.id}/variables/9999", user)
+
+ expect(response.status).to eq(404)
+ end
end
context 'authorized user with invalid permissions' do
@@ -90,6 +96,12 @@ describe API::API, api: true do
expect(updated_variable.key).to eq('TEST_VARIABLE_1_UP')
expect(updated_variable.value).to eq('VALUE_1_UP')
end
+
+ it 'should responde with 404 Not Found if requesting non-existing variable' do
+ put api("/projects/#{project.id}/variables/9999", user)
+
+ expect(response.status).to eq(404)
+ end
end
context 'authorized user with invalid permissions' do
@@ -117,6 +129,12 @@ describe API::API, api: true do
end.to change{project.variables.count}.by(-1)
expect(response.status).to eq(200)
end
+
+ it 'should responde with 404 Not Found if requesting non-existing variable' do
+ delete api("/projects/#{project.id}/variables/9999", user)
+
+ expect(response.status).to eq(404)
+ end
end
context 'authorized user with invalid permissions' do