Sha256: f0026921abd6a57a3f57ccb9d5e94f5e8df3375ad6ffaecae937c6107af78463

Contents?: true

Size: 1.06 KB

Versions: 20

Compression:

Stored size: 1.06 KB

Contents

require 'kontena/main_command'

describe Kontena::MainCommand do
  let(:subject) { described_class.new('kontena') }

  describe '--version' do
    it 'outputs the version number and exits' do
      expect do
        expect{subject.run(['--version'])}.to output(/kontena-cli #{Kontena::Cli::VERSION}/).to_stdout
      end.to raise_error(SystemExit) do |exc|
        expect(exc.status).to eq 0
      end
    end
  end

  describe '#subcommand_missing' do
    it 'suggests plugin install for known plugin commands' do
      expect(subject).to receive(:known_plugin_subcommand?).with('testplugin').and_return(true)
      expect(subject).to receive(:exit_with_error).with(/plugin has not been installed/).and_call_original
      expect{subject.run(['testplugin', 'master', 'create'])}.to exit_with_error
    end

    it 'runs normal error handling for unknown sub commands' do
      expect(subject).to receive(:known_plugin_subcommand?).with('testplugin').and_return(false)
      expect{subject.run(['testplugin', 'master', 'create'])}.to raise_error(Clamp::UsageError)
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
kontena-cli-1.5.4 spec/kontena/main_command_spec.rb
kontena-cli-1.5.4.rc1 spec/kontena/main_command_spec.rb
kontena-cli-1.5.3 spec/kontena/main_command_spec.rb
kontena-cli-1.5.2 spec/kontena/main_command_spec.rb
kontena-cli-1.5.1 spec/kontena/main_command_spec.rb
kontena-cli-1.5.0 spec/kontena/main_command_spec.rb
kontena-cli-1.5.0.rc1 spec/kontena/main_command_spec.rb
kontena-cli-1.5.0.pre5 spec/kontena/main_command_spec.rb
kontena-cli-1.5.0.pre4 spec/kontena/main_command_spec.rb
kontena-cli-1.5.0.pre3 spec/kontena/main_command_spec.rb
kontena-cli-1.5.0.pre2 spec/kontena/main_command_spec.rb
kontena-cli-1.5.0.pre1 spec/kontena/main_command_spec.rb
kontena-cli-1.4.3 spec/kontena/main_command_spec.rb
kontena-cli-1.4.3.rc1 spec/kontena/main_command_spec.rb
kontena-cli-1.4.2 spec/kontena/main_command_spec.rb
kontena-cli-1.4.2.rc1 spec/kontena/main_command_spec.rb
kontena-cli-1.4.2.pre1 spec/kontena/main_command_spec.rb
kontena-cli-1.4.1 spec/kontena/main_command_spec.rb
kontena-cli-1.4.1.rc1 spec/kontena/main_command_spec.rb
kontena-cli-1.4.1.pre1 spec/kontena/main_command_spec.rb