Commit ba169cc5 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

API: projects/all tests

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent a09fc160
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment