Sha256: 81209f96fd46035bd6e49a194181c26a5be003055f3d4e9dfaab8a6d4b352989

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

require 'kontena_cli'
require 'kontena/light_prompt'
require 'kontena/cli/whoami_command'

describe Kontena do
  context 'prompt' do
    before(:each) do
      Kontena.reset_prompt
    end

    after(:each) do
      Kontena.reset_prompt
    end

    it 'uses light prompt on windows' do
      allow(ENV).to receive(:[]).with('OS').and_return('Windows_NT')
      expect(Kontena.prompt).to be_kind_of(Kontena::LightPrompt)
    end
  end

  describe '#minor_version' do
    it "returns a version string" do
      expect(Kontena.minor_version).to match /^\d+\.\d+$/
    end
  end

  describe '#run' do
    let(:whoami) { double(:whoami) }

    before(:each) do
      expect(Kontena::Cli::WhoamiCommand).to receive(:new).and_return(whoami)
      expect(whoami).to receive(:run).with(['--bash-completion-path']).and_return(true)
    end

    it 'accepts a command line as string' do
      Kontena.run('whoami --bash-completion-path')
    end

    it 'accepts a command line as a list of parameters' do
      Kontena.run('whoami', '--bash-completion-path')
    end

    it 'accepts a command line as an array' do
      Kontena.run(['whoami', '--bash-completion-path'])
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kontena-cli-1.2.0 spec/kontena/kontena_cli_spec.rb
kontena-cli-1.2.0.rc3 spec/kontena/kontena_cli_spec.rb
kontena-cli-1.2.0.rc2 spec/kontena/kontena_cli_spec.rb
kontena-cli-1.2.0.rc1 spec/kontena/kontena_cli_spec.rb