create_branch_service_spec.rb 625 Bytes
Newer Older
1 2
require 'spec_helper'

3
describe CreateBranchService do
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
  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