Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-31 22:44:20 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-31 22:44:20 +0400
commit5857a7a9ce6f9bd37b633d48074778bcbde880a4 (patch)
tree10bc126e3da80bbd4133a51e36636186655101cf /spec
parentdfe2a742c2f2b862109a757cf90495ea1fcde70c (diff)
parent2c7554e897356fe424f292c66cd03e0192b05167 (diff)
Merge pull request #2839 from m4tthumphrey/protected-branches-api
Added methods to protect and unprotect branches in from the API
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/api/projects_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb
index c2244210bcf..d932fd9e74d 100644
--- a/spec/requests/api/projects_spec.rb
+++ b/spec/requests/api/projects_spec.rb
@@ -107,6 +107,29 @@ describe Gitlab::API do
json_response['name'].should == 'new_design'
json_response['commit']['id'].should == '621491c677087aa243f165eab467bfdfbee00be1'
+ json_response['protected'].should == false
+ end
+ end
+
+ describe "PUT /projects/:id/repository/branches/:branch/protect" do
+ it "should protect a single branch" do
+ put api("/projects/#{project.id}/repository/branches/new_design/protect", user)
+ response.status.should == 200
+
+ json_response['name'].should == 'new_design'
+ json_response['commit']['id'].should == '621491c677087aa243f165eab467bfdfbee00be1'
+ json_response['protected'].should == true
+ end
+ end
+
+ describe "PUT /projects/:id/repository/branches/:branch/unprotect" do
+ it "should unprotect a single branch" do
+ put api("/projects/#{project.id}/repository/branches/new_design/unprotect", user)
+ response.status.should == 200
+
+ json_response['name'].should == 'new_design'
+ json_response['commit']['id'].should == '621491c677087aa243f165eab467bfdfbee00be1'
+ json_response['protected'].should == false
end
end