Sha256: 9690114ecaaa635efead62af7d5da9c9d3b5c3c02f706995d3b730d367a0a876

Contents?: true

Size: 1.2 KB

Versions: 17

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'
require 'thegarage/gitx/cli/cleanup_command'

describe Thegarage::Gitx::Cli::CleanupCommand do
  let(:args) { [] }
  let(:options) { {} }
  let(:config) do
    {
      pretend: true
    }
  end
  let(:cli) { Thegarage::Gitx::Cli::CleanupCommand.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 '#cleanup' do
    before do
      allow(cli).to receive(:say)

      expect(cli).to receive(:merged_remote_branches).and_return(%w( merged-remote-feature ))
      expect(cli).to receive(:merged_local_branches).and_return(%w( merged-local-feature ))

      expect(cli).to receive(:run_cmd).with('git checkout master').ordered
      expect(cli).to receive(:run_cmd).with('git pull').ordered
      expect(cli).to receive(:run_cmd).with('git remote prune origin').ordered
      expect(cli).to receive(:run_cmd).with('git push origin --delete merged-remote-feature').ordered
      expect(cli).to receive(:run_cmd).with('git branch -d merged-local-feature').ordered

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

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
thegarage-gitx-2.3.0.pre1 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.2.3 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.2.3.pre2 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.2.3.pre1 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.2.2 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.2.1 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.2.0 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.1.1 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.1.0 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.0.5 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.0.4 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.0.3 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.0.2 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.0.1 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.0.0 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.0.0.pre2 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.0.0.pre1 spec/thegarage/gitx/cli/cleanup_command_spec.rb