Additional Admin APIs

This commit is contained in:
Angus MacArthur 2012-11-14 15:37:52 -05:00 committed by Angus MacArthur
parent d5663e148f
commit 61ffcab60f
6 changed files with 150 additions and 0 deletions

View file

@ -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