Sha256: bbc713f0304cdc97549c9d16ac8350bd0e55a611af66111342576e14307669cf

Contents?: true

Size: 988 Bytes

Versions: 33

Compression:

Stored size: 988 Bytes

Contents

require 'kontena/cli/master/use_command'

describe Kontena::Cli::Master::UseCommand do

  include ClientHelpers

  let(:subject) do
    described_class.new(File.basename($0))
  end

  describe '#use' do
    it 'should update current master' do
      expect(subject.config).to receive(:write).and_return(true)
      subject.run(['some_master'])
      expect(subject.config.current_server).to eq 'some_master'
    end

    it 'should abort with error message if master is not configured' do
      expect { subject.run(['not_existing']) }.to output(/Could not resolve master with name: 'not_existing'/).to_stderr
    end

    it 'should abort with error message if master is not given' do
      expect { subject.run([]) }.to raise_error Clamp::UsageError
    end

    it 'should clear current master when --clear given' do
      expect(subject.config).to receive(:write).and_return(true)
      subject.run(['--clear'])
      expect(subject.config.current_server).to be_nil
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
kontena-cli-1.3.4.rc1 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.3.3 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.3.3.rc1 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.3.2 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.3.2.rc2 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.3.2.rc1 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.3.1 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.3.1.rc2 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.3.1.rc1 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.3.0 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.3.0.rc4 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.3.0.rc3 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.3.0.rc2 spec/kontena/cli/master/use_command_spec.rb