Sha256: 56ea025b1544cc905b1b1e1069c2d246cd74e01d8ed72de33d5d6621caac089d

Contents?: true

Size: 1.9 KB

Versions: 23

Compression:

Stored size: 1.9 KB

Contents

require 'spec_helper'
require 'thegarage/gitx/cli/release_command'

describe Thegarage::Gitx::Cli::ReleaseCommand do
  let(:args) { [] }
  let(:options) { {} }
  let(:config) do
    {
      pretend: true
    }
  end
  let(:cli) { Thegarage::Gitx::Cli::ReleaseCommand.new(args, options, config) }
  let(:branch) { double('fake branch', name: 'feature-branch') }

  before do
    allow(cli).to receive(:current_branch).and_return(branch)
  end

  describe '#release' do
    context 'when user rejects release' do
      before do
        expect(cli).to receive(:yes?).and_return(false)
        expect(cli).to_not receive(:run_cmd)

        cli.release
      end
      it 'only runs update commands' do
        should meet_expectations
      end
    end
    context 'when user confirms release' do
      let(:fake_update_command) { double('fake update command', update: nil) }
      let(:fake_integrate_command) { double('fake integrate command') }
      let(:fake_cleanup_command) { double('fake cleanup command', cleanup: nil) }
      before do
        expect(Thegarage::Gitx::Cli::UpdateCommand).to receive(:new).and_return(fake_update_command)
        expect(Thegarage::Gitx::Cli::IntegrateCommand).to receive(:new).and_return(fake_integrate_command)
        expect(Thegarage::Gitx::Cli::CleanupCommand).to receive(:new).and_return(fake_cleanup_command)

        expect(fake_integrate_command).to receive(:integrate).with('staging')

        expect(cli).to receive(:yes?).and_return(true)

        expect(cli).to receive(:run_cmd).with("git checkout master").ordered
        expect(cli).to receive(:run_cmd).with("git pull origin master").ordered
        expect(cli).to receive(:run_cmd).with("git merge --no-ff feature-branch").ordered
        expect(cli).to receive(:run_cmd).with("git push origin HEAD").ordered

        cli.release
      end
      it 'runs expected commands' do
        should meet_expectations
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
thegarage-gitx-2.6.0 spec/thegarage/gitx/cli/release_command_spec.rb
thegarage-gitx-2.5.1 spec/thegarage/gitx/cli/release_command_spec.rb
thegarage-gitx-2.5.0 spec/thegarage/gitx/cli/release_command_spec.rb
thegarage-gitx-2.5.0.beta5 spec/thegarage/gitx/cli/release_command_spec.rb
thegarage-gitx-2.5.0.beta4 spec/thegarage/gitx/cli/release_command_spec.rb
thegarage-gitx-2.5.0.beta3 spec/thegarage/gitx/cli/release_command_spec.rb
thegarage-gitx-2.5.0.beta2 spec/thegarage/gitx/cli/release_command_spec.rb
thegarage-gitx-2.5.0.beta1 spec/thegarage/gitx/cli/release_command_spec.rb
thegarage-gitx-2.4.2 spec/thegarage/gitx/cli/release_command_spec.rb
thegarage-gitx-2.5.0.alpha1 spec/thegarage/gitx/cli/release_command_spec.rb
thegarage-gitx-2.4.1 spec/thegarage/gitx/cli/release_command_spec.rb
thegarage-gitx-2.4.0 spec/thegarage/gitx/cli/release_command_spec.rb
thegarage-gitx-2.4.0.pre1 spec/thegarage/gitx/cli/release_command_spec.rb
thegarage-gitx-2.3.0 spec/thegarage/gitx/cli/release_command_spec.rb
thegarage-gitx-2.3.0.pre1 spec/thegarage/gitx/cli/release_command_spec.rb
thegarage-gitx-2.2.3 spec/thegarage/gitx/cli/release_command_spec.rb
thegarage-gitx-2.2.3.pre2 spec/thegarage/gitx/cli/release_command_spec.rb
thegarage-gitx-2.2.3.pre1 spec/thegarage/gitx/cli/release_command_spec.rb
thegarage-gitx-2.2.2 spec/thegarage/gitx/cli/release_command_spec.rb
thegarage-gitx-2.2.1 spec/thegarage/gitx/cli/release_command_spec.rb