Sha256: 445cccc82328a19ff75e702b94c5233d263072bdb6b115dccfb342c55ea1c280
Contents?: true
Size: 1.28 KB
Versions: 6
Compression:
Stored size: 1.28 KB
Contents
require 'spec_helper' require 'git_helper' describe GitHelper::NewBranch do let(:new_branch_name) { 'new-branch-name' } let(:local_code) { double(:local_code, new_branch: :commit) } let(:cli) { double(:highline_cli, new_branch_name: new_branch_name) } subject { GitHelper::NewBranch.new } before do allow(GitHelper::LocalCode).to receive(:new).and_return(local_code) allow(GitHelper::HighlineCli).to receive(:new).and_return(cli) end it 'should call GitHelper::LocalCode' do expect(GitHelper::LocalCode).to receive(:new).and_return(local_code) subject.execute end it 'should call the new_branch method from the local code class' do expect(local_code).to receive(:new_branch) subject.execute end context 'when no branch name is passed in' do it 'should call the highline cli' do expect(GitHelper::HighlineCli).to receive(:new).and_return(cli) subject.execute end it 'should ask the highline cli what the new branch name should be' do expect(cli).to receive(:new_branch_name) subject.execute end end context 'when there is a branch name passed in' do it 'should not create a highline cli' do expect(GitHelper::HighlineCli).not_to receive(:new) subject.execute(new_branch_name) end end end
Version data entries
6 entries across 6 versions & 1 rubygems