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.5 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.3.5.rc1 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.4.0 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.4.0.rc2 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.4.0.rc1 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.4.0.pre14 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.4.0.pre13 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.4.0.pre12 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.4.0.pre11 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.4.0.pre10 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.4.0.pre9 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.4.0.pre8 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.4.0.pre7 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.4.0.pre6 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.4.0.pre5 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.4.0.pre4 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.4.0.pre3 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.4.0.pre2 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.4.0.pre1 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-1.3.4 spec/kontena/cli/master/use_command_spec.rb