diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-11-18 16:42:56 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-11-18 16:42:56 +0200 |
commit | ba169cc52d42425525921464070a513097a003ff (patch) | |
tree | 0b6f800d7d562da3c40258dbf9e9731128089252 /spec/requests | |
parent | a09fc160d02f232e9819c7459a9ff91a4e990bf3 (diff) | |
download | gitlab-ce-ba169cc52d42425525921464070a513097a003ff.tar.gz |
API: projects/all tests
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/projects_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 2ae186b967a..e4cef6c587c 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -36,6 +36,32 @@ describe API::API do end end + describe "GET /projects/all" do + context "when unauthenticated" do + it "should return authentication error" do + get api("/projects/all") + response.status.should == 401 + end + end + + context "when authenticated as regular user" do + it "should return authentication error" do + get api("/projects/all", user) + response.status.should == 403 + end + end + + context "when authenticated as admin" do + it "should return an array of all projects" do + get api("/projects/all", admin) + response.status.should == 200 + json_response.should be_an Array + json_response.first['name'].should == project.name + json_response.first['owner']['email'].should == user.email + end + end + end + describe "POST /projects" do context "maximum number of projects reached" do before do |