From b6f249dc1f4b1867f8f16a23b30f65f4be8e7fd7 Mon Sep 17 00:00:00 2001 From: Nihad Abbasov Date: Wed, 12 Sep 2012 05:11:56 -0700 Subject: [PATCH] make API specs more organized and readable --- spec/requests/api/issues_spec.rb | 10 ++++++---- spec/requests/api/projects_spec.rb | 10 ++++++---- spec/requests/api/users_spec.rb | 10 ++++++---- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb index 293ea83ae6c..442e9c730dc 100644 --- a/spec/requests/api/issues_spec.rb +++ b/spec/requests/api/issues_spec.rb @@ -9,12 +9,14 @@ describe Gitlab::API do before { project.add_access(user, :read) } describe "GET /issues" do - it "should return authentication error" do - get api("/issues") - response.status.should == 401 + context "when unauthenticated" do + it "should return authentication error" do + get api("/issues") + response.status.should == 401 + end end - describe "authenticated GET /issues" do + context "when authenticated" do it "should return an array of issues" do get api("/issues", user) response.status.should == 200 diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index cc6843ccb66..9412287f6b0 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -9,12 +9,14 @@ describe Gitlab::API do before { project.add_access(user, :read) } describe "GET /projects" do - it "should return authentication error" do - get api("/projects") - response.status.should == 401 + context "when unauthenticated" do + it "should return authentication error" do + get api("/projects") + response.status.should == 401 + end end - describe "authenticated GET /projects" do + context "when authenticated" do it "should return an array of projects" do get api("/projects", user) response.status.should == 200 diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index d791962adc2..e25fe1341d5 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -6,12 +6,14 @@ describe Gitlab::API do let(:user) { Factory :user } describe "GET /users" do - it "should return authentication error" do - get api("/users") - response.status.should == 401 + context "when unauthenticated" do + it "should return authentication error" do + get api("/users") + response.status.should == 401 + end end - describe "authenticated GET /users" do + context "when authenticated" do it "should return an array of users" do get api("/users", user) response.status.should == 200