diff options
author | Sebastian Ziebell <sebastian.ziebell@asquera.de> | 2013-02-27 20:50:30 +0400 |
---|---|---|
committer | Sebastian Ziebell <sebastian.ziebell@asquera.de> | 2013-02-27 20:50:30 +0400 |
commit | 7499f65014257989510da50505fa7c0f5a4fae88 (patch) | |
tree | b8c9355b73ec48c12bfa9d6416fa91ba4c4444e6 /spec | |
parent | 43d75960303be538fb79804ca6e2a90241aee0df (diff) |
API: extracted helper method to validate required parameters, code clean up
Added a helper method to check if required parameters are given in an API call. Can be used
to return a `400 Bad Request` return code if a required attribute is missing.
Code clean up and fixed tests.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/projects_spec.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 9fbdd52eefc..71a33f85101 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -424,10 +424,10 @@ describe Gitlab::API do end end - describe "DELETE /projects/:id/hooks/:hook_id" do + describe "DELETE /projects/:id/hooks" do it "should delete hook from project" do expect { - delete api("/projects/#{project.id}/hooks/#{hook.id}", user) + delete api("/projects/#{project.id}/hooks", user), hook_id: hook.id }.to change {project.hooks.count}.by(-1) response.status.should == 200 end @@ -466,7 +466,8 @@ describe Gitlab::API do response.status.should == 200 json_response.should be_an Array - json_response.first['id'].should == project.repository.commit.id + #json_response.first['id'].should == project.repository.commit.id + json_response.size.should == 1 end end |