From 33a00ceeeacfc52272d25cef914a027b9bf13a2a Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 1 Apr 2014 10:39:53 +0300 Subject: Create branch via API Signed-off-by: Dmitriy Zaporozhets --- spec/requests/api/branches_spec.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'spec') diff --git a/spec/requests/api/branches_spec.rb b/spec/requests/api/branches_spec.rb index 47c0ba94a4a..f792c618e67 100644 --- a/spec/requests/api/branches_spec.rb +++ b/spec/requests/api/branches_spec.rb @@ -92,4 +92,24 @@ describe API::API do end + describe "POST /projects/:id/repository/branches" do + it "should create a new branch" do + post api("/projects/#{project.id}/repository/branches", user), + branch_name: 'new_design', + ref: '621491c677087aa243f165eab467bfdfbee00be1' + + response.status.should == 201 + + json_response['name'].should == 'new_design' + json_response['commit']['id'].should == '621491c677087aa243f165eab467bfdfbee00be1' + end + + it "should deny for user without push access" do + post api("/projects/#{project.id}/repository/branches", user2), + branch_name: 'new_design', + ref: '621491c677087aa243f165eab467bfdfbee00be1' + + response.status.should == 403 + end + end end -- cgit v1.2.1