2019-07-31 22:56:46 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
describe CreateBranchService do
|
2017-08-17 22:00:37 +05:30
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:service) { described_class.new(project, user) }
|
|
|
|
|
|
|
|
describe '#execute' do
|
|
|
|
context 'when repository is empty' do
|
|
|
|
let(:project) { create(:project_empty_repo) }
|
|
|
|
|
|
|
|
it 'creates master branch' do
|
|
|
|
service.execute('my-feature', 'master')
|
|
|
|
|
|
|
|
expect(project.repository.branch_exists?('master')).to be_truthy
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'creates my-feature branch' do
|
|
|
|
service.execute('my-feature', 'master')
|
|
|
|
|
|
|
|
expect(project.repository.branch_exists?('my-feature')).to be_truthy
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|