Commit b6f249dc1f4b1867f8f16a23b30f65f4be8e7fd7
1 parent
a87c268f
Exists in
master
and in
4 other branches
make API specs more organized and readable
Showing
3 changed files
with
18 additions
and
12 deletions
Show diff stats
spec/requests/api/issues_spec.rb
| ... | ... | @@ -9,12 +9,14 @@ describe Gitlab::API do |
| 9 | 9 | before { project.add_access(user, :read) } |
| 10 | 10 | |
| 11 | 11 | describe "GET /issues" do |
| 12 | - it "should return authentication error" do | |
| 13 | - get api("/issues") | |
| 14 | - response.status.should == 401 | |
| 12 | + context "when unauthenticated" do | |
| 13 | + it "should return authentication error" do | |
| 14 | + get api("/issues") | |
| 15 | + response.status.should == 401 | |
| 16 | + end | |
| 15 | 17 | end |
| 16 | 18 | |
| 17 | - describe "authenticated GET /issues" do | |
| 19 | + context "when authenticated" do | |
| 18 | 20 | it "should return an array of issues" do |
| 19 | 21 | get api("/issues", user) |
| 20 | 22 | response.status.should == 200 | ... | ... |
spec/requests/api/projects_spec.rb
| ... | ... | @@ -9,12 +9,14 @@ describe Gitlab::API do |
| 9 | 9 | before { project.add_access(user, :read) } |
| 10 | 10 | |
| 11 | 11 | describe "GET /projects" do |
| 12 | - it "should return authentication error" do | |
| 13 | - get api("/projects") | |
| 14 | - response.status.should == 401 | |
| 12 | + context "when unauthenticated" do | |
| 13 | + it "should return authentication error" do | |
| 14 | + get api("/projects") | |
| 15 | + response.status.should == 401 | |
| 16 | + end | |
| 15 | 17 | end |
| 16 | 18 | |
| 17 | - describe "authenticated GET /projects" do | |
| 19 | + context "when authenticated" do | |
| 18 | 20 | it "should return an array of projects" do |
| 19 | 21 | get api("/projects", user) |
| 20 | 22 | response.status.should == 200 | ... | ... |
spec/requests/api/users_spec.rb
| ... | ... | @@ -6,12 +6,14 @@ describe Gitlab::API do |
| 6 | 6 | let(:user) { Factory :user } |
| 7 | 7 | |
| 8 | 8 | describe "GET /users" do |
| 9 | - it "should return authentication error" do | |
| 10 | - get api("/users") | |
| 11 | - response.status.should == 401 | |
| 9 | + context "when unauthenticated" do | |
| 10 | + it "should return authentication error" do | |
| 11 | + get api("/users") | |
| 12 | + response.status.should == 401 | |
| 13 | + end | |
| 12 | 14 | end |
| 13 | 15 | |
| 14 | - describe "authenticated GET /users" do | |
| 16 | + context "when authenticated" do | |
| 15 | 17 | it "should return an array of users" do |
| 16 | 18 | get api("/users", user) |
| 17 | 19 | response.status.should == 200 | ... | ... |