summaryrefslogtreecommitdiff
path: root/spec/requests
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-12-01 16:55:33 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-12-01 16:55:33 +0200
commit612b8806ddc7881421e26a9dbfe465d6445fb3d6 (patch)
tree18a918b7cdf7dcc8ce7d4cdc7cd42ac39c57a5e1 /spec/requests
parent06b7907c2afe0cb0fa25f4cdef0ff470710de2f9 (diff)
downloadgitlab-ce-612b8806ddc7881421e26a9dbfe465d6445fb3d6.tar.gz
Fix internal API for missing project or key
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/api/internal_spec.rb24
1 files changed, 21 insertions, 3 deletions
diff --git a/spec/requests/api/internal_spec.rb b/spec/requests/api/internal_spec.rb
index 53b7808d4c3..4faa1f9b964 100644
--- a/spec/requests/api/internal_spec.rb
+++ b/spec/requests/api/internal_spec.rb
@@ -26,7 +26,7 @@ describe API::API, api: true do
end
end
- describe "GET /internal/allowed" do
+ describe "POST /internal/allowed" do
context "access granted" do
before do
project.team << [user, :developer]
@@ -140,7 +140,7 @@ describe API::API, api: true do
archive(key, project)
response.status.should == 200
- response.body.should == 'true'
+ JSON.parse(response.body)["status"].should be_true
end
end
@@ -149,10 +149,28 @@ describe API::API, api: true do
archive(key, project)
response.status.should == 200
- response.body.should == 'false'
+ JSON.parse(response.body)["status"].should be_false
end
end
end
+
+ context 'project does not exist' do
+ it do
+ pull(key, OpenStruct.new(path_with_namespace: 'gitlab/notexists'))
+
+ response.status.should == 200
+ JSON.parse(response.body)["status"].should be_false
+ end
+ end
+
+ context 'user does not exist' do
+ it do
+ pull(OpenStruct.new(id: 0), project)
+
+ response.status.should == 200
+ JSON.parse(response.body)["status"].should be_false
+ end
+ end
end
def pull(key, project)