Sha256: 2e8f537d8c797b88ba075acd74f2d71bcdcab9e7761e522e7da3c53926d1ef66

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

describe Kontena::Plugin::Shell::KontenaCommand do
  context '#run' do
    it 'should be able to run kontena commands' do
      expect{described_class.new([], ['version', '--cli']).run}.to output(/cli:/).to_stdout
    end

    it 'should not run a shell inside a shell' do
      expect{described_class.new([], ['shell']).run}.to output(/Already/).to_stdout
    end

    it 'should switch context if a command with subcommands is run without args' do
      context = Kontena::Plugin::Shell::Context.new(nil)
      described_class.new(context, ['master', 'user']).run
      expect(context.to_s).to eq 'master user'
    end
  end

  context 'completions' do
    it 'should be able to complete kontena commands' do
      expect(described_class.completions.first.call([], ['master', 'user'], 'l')).to include('invite', 'list')
    end

  end

  context 'help' do
    it 'should be able to get help for kontena commands' do
      expect(described_class.help.call([], ['master', 'user'])).to match(/SUBCOMMAND.*invite.*list/m)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kontena-plugin-shell-0.2.0 spec/kontena/plugin/shell/commands/kontena_spec.rb
kontena-plugin-shell-0.1.3 spec/kontena/plugin/shell/commands/kontena_spec.rb
kontena-plugin-shell-0.1.2 spec/kontena/plugin/shell/commands/kontena_spec.rb