Fix CreateBranchService after Repository#commit_file was renamed to create_file

Closes #29687
This commit is contained in:
Adam Niedzielski 2017-03-20 13:01:06 +01:00
parent 46146e33f2
commit 163ba974a4
2 changed files with 27 additions and 3 deletions

View file

@ -25,12 +25,12 @@ class CreateBranchService < BaseService
private
def create_master_branch
project.repository.commit_file(
project.repository.create_file(
current_user,
'/README.md',
'',
message: 'Add README.md',
branch_name: 'master',
update: false)
branch_name: 'master'
)
end
end

View file

@ -0,0 +1,24 @@
require 'spec_helper'
describe CreateBranchService, services: true do
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