BigW Consortium Gitlab

Commit 169c70fd by Sean McGivern Committed by Lin Jen-Shin

Merge branch 'create-branch-service-create-file' into 'master'

Fix CreateBranchService after Repository#commit_file was renamed to create_file Closes #29687 See merge request !10081
parent afa4bd1b
...@@ -25,12 +25,12 @@ class CreateBranchService < BaseService ...@@ -25,12 +25,12 @@ class CreateBranchService < BaseService
private private
def create_master_branch def create_master_branch
project.repository.commit_file( project.repository.create_file(
current_user, current_user,
'/README.md', '/README.md',
'', '',
message: 'Add README.md', message: 'Add README.md',
branch_name: 'master', branch_name: 'master'
update: false) )
end end
end end
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment