Sha256: 719e67e1f2a9ea80b28f060c0d44e1b35d173d9850e82442131905285a9a4d26

Contents?: true

Size: 1.23 KB

Versions: 28

Compression:

Stored size: 1.23 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(: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 branch -r --merged').and_return("merged-remote-feature").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 --merged').and_return("merged-local-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

28 entries across 28 versions & 1 rubygems

Version Path
thegarage-gitx-2.14.0 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.13.1 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.13.0 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.12.0 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.11.0 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.10.2 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.10.1 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.10.0 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.9.0 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.8.1 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.8.0 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.7.2 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.7.1 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.7.0 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.6.0 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.5.1 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.5.0 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.5.0.beta5 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.5.0.beta4 spec/thegarage/gitx/cli/cleanup_command_spec.rb
thegarage-gitx-2.5.0.beta3 spec/thegarage/gitx/cli/cleanup_command_spec.rb