Commit b6f249dc authored by Nihad Abbasov's avatar Nihad Abbasov

make API specs more organized and readable

parent a87c268f
...@@ -9,12 +9,14 @@ describe Gitlab::API do ...@@ -9,12 +9,14 @@ describe Gitlab::API do
before { project.add_access(user, :read) } before { project.add_access(user, :read) }
describe "GET /issues" do describe "GET /issues" do
context "when unauthenticated" do
it "should return authentication error" do it "should return authentication error" do
get api("/issues") get api("/issues")
response.status.should == 401 response.status.should == 401
end end
end
describe "authenticated GET /issues" do context "when authenticated" do
it "should return an array of issues" do it "should return an array of issues" do
get api("/issues", user) get api("/issues", user)
response.status.should == 200 response.status.should == 200
......
...@@ -9,12 +9,14 @@ describe Gitlab::API do ...@@ -9,12 +9,14 @@ describe Gitlab::API do
before { project.add_access(user, :read) } before { project.add_access(user, :read) }
describe "GET /projects" do describe "GET /projects" do
context "when unauthenticated" do
it "should return authentication error" do it "should return authentication error" do
get api("/projects") get api("/projects")
response.status.should == 401 response.status.should == 401
end end
end
describe "authenticated GET /projects" do context "when authenticated" do
it "should return an array of projects" do it "should return an array of projects" do
get api("/projects", user) get api("/projects", user)
response.status.should == 200 response.status.should == 200
......
...@@ -6,12 +6,14 @@ describe Gitlab::API do ...@@ -6,12 +6,14 @@ describe Gitlab::API do
let(:user) { Factory :user } let(:user) { Factory :user }
describe "GET /users" do describe "GET /users" do
context "when unauthenticated" do
it "should return authentication error" do it "should return authentication error" do
get api("/users") get api("/users")
response.status.should == 401 response.status.should == 401
end end
end
describe "authenticated GET /users" do context "when authenticated" do
it "should return an array of users" do it "should return an array of users" do
get api("/users", user) get api("/users", user)
response.status.should == 200 response.status.should == 200
......
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