gitlab-org--gitlab-foss/spec/services/projects/transfer_service_spec.rb
2014-03-22 16:38:22 -04:00

33 lines
837 B
Ruby

require 'spec_helper'
describe ProjectTransferService do
before(:each) { enable_observers }
after(:each) {disable_observers}
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) }
it { lambda{service.transfer(project, nil)}.should raise_error(ActiveRecord::RecordInvalid) }
end
def service
service = ProjectTransferService.new
service.gitlab_shell.stub(mv_repository: true)
service
end
end