Sha256: 9dc54893dc1a55f1b0bec8e79b35150d43b6089be64b75f5e58e4fcc5be9e200

Contents?: true

Size: 1.2 KB

Versions: 46

Compression:

Stored size: 1.2 KB

Contents

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

describe Gitx::Cli::CleanupCommand do
  let(:args) { [] }
  let(:options) { {} }
  let(:config) do
    {
      pretend: true
    }
  end
  let(:cli) { 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

46 entries across 46 versions & 1 rubygems

Version Path
gitx-2.21.3.ci.135.1 spec/gitx/cli/cleanup_command_spec.rb
gitx-2.21.3 spec/gitx/cli/cleanup_command_spec.rb
gitx-2.21.2.ci.134.1 spec/gitx/cli/cleanup_command_spec.rb
gitx-2.21.2.ci.130.1 spec/gitx/cli/cleanup_command_spec.rb
gitx-2.21.2 spec/gitx/cli/cleanup_command_spec.rb
gitx-2.21.1.ci.125.1 spec/gitx/cli/cleanup_command_spec.rb
gitx-2.21.1 spec/gitx/cli/cleanup_command_spec.rb
gitx-2.21.0.ci.121.1 spec/gitx/cli/cleanup_command_spec.rb
gitx-2.21.0 spec/gitx/cli/cleanup_command_spec.rb
gitx-2.20.0 spec/gitx/cli/cleanup_command_spec.rb
gitx-2.20.0.ci.117.1 spec/gitx/cli/cleanup_command_spec.rb
gitx-2.19.0.ci.114.1 spec/gitx/cli/cleanup_command_spec.rb
gitx-2.19.0.ci.112.1 spec/gitx/cli/cleanup_command_spec.rb
gitx-2.19.0 spec/gitx/cli/cleanup_command_spec.rb
gitx-2.18.0.ci.106.1 spec/gitx/cli/cleanup_command_spec.rb
gitx-2.18.0 spec/gitx/cli/cleanup_command_spec.rb
gitx-2.18.0.pre.ci.104.1 spec/gitx/cli/cleanup_command_spec.rb
gitx-2.18.0.pre spec/gitx/cli/cleanup_command_spec.rb
gitx-2.17.0.pre.ci.101.1 spec/gitx/cli/cleanup_command_spec.rb
gitx-2.17.0.pre spec/gitx/cli/cleanup_command_spec.rb