From 61ffcab60fef2efcd54b8496aa09de79ee999a2c Mon Sep 17 00:00:00 2001 From: Angus MacArthur Date: Wed, 14 Nov 2012 15:37:52 -0500 Subject: Additional Admin APIs --- spec/requests/api/groups_spec.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'spec/requests/api/groups_spec.rb') diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb index c39a4228408..63616eef1bb 100644 --- a/spec/requests/api/groups_spec.rb +++ b/spec/requests/api/groups_spec.rb @@ -90,4 +90,27 @@ describe Gitlab::API do end end end + + describe "POST /groups/:id/projects/:project_id" do + let(:project) { create(:project) } + before(:each) do + project.stub!(:transfer).and_return(true) + Project.stub(:find).and_return(project) + end + + + context "when authenticated as user" do + it "should not transfer project to group" do + post api("/groups/#{group1.id}/projects/#{project.id}", user2) + response.status.should == 403 + end + end + + context "when authenticated as admin" do + it "should transfer project to group" do + project.should_receive(:transfer) + post api("/groups/#{group1.id}/projects/#{project.id}", admin) + end + end + end end -- cgit v1.2.1