2013-03-12 06:37:53 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe ProjectTransferService do
|
2013-04-10 16:48:40 -04:00
|
|
|
before(:each) { enable_observers }
|
2013-04-25 10:15:33 -04:00
|
|
|
after(:each) {disable_observers}
|
2013-04-10 16:48:40 -04:00
|
|
|
|
2013-03-12 06:37:53 -04:00
|
|
|
context 'namespace -> namespace' do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:group) { create(:group) }
|
|
|
|
let(:project) { create(:project, namespace: user.namespace) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
@result = service.transfer(project, group)
|
|
|
|
end
|
|
|
|
|
|
|
|
it { @result.should be_true }
|
|
|
|
it { project.namespace.should == group }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'namespace -> no namespace' do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project, namespace: user.namespace) }
|
|
|
|
|
2013-09-17 09:12:10 -04:00
|
|
|
it { lambda{service.transfer(project, nil)}.should raise_error(ActiveRecord::RecordInvalid) }
|
2013-03-12 06:37:53 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def service
|
|
|
|
service = ProjectTransferService.new
|
|
|
|
service.gitlab_shell.stub(mv_repository: true)
|
|
|
|
service
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|