Sha256: 5ea6d5379c417f0920cb6239be9bfd979acaa5fc096b6e23a88099a443fa5cfc

Contents?: true

Size: 1.16 KB

Versions: 29

Compression:

Stored size: 1.16 KB

Contents

require_relative "../../../spec_helper"
require 'kontena/cli/master/use_command'

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

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

  let(:client) { spy(:client) }

  let(:valid_settings) do
    {'current_server' => 'alias',
     'servers' => [
         {'name' => 'some_master', 'url' => 'some_master'},
         {'name' => 'alias', 'url' => 'someurl', 'token' => '123456'}
     ]
    }
  end

  describe '#use' do
    it 'should update current master' do
      allow(subject).to receive(:client).and_return(client)
      allow(subject).to receive(:settings).and_return(valid_settings)
      expect(subject).to receive(:current_master=).with('some_master')
      subject.run(['some_master'])
    end

    it 'should fetch grid list from master' do
      allow(subject).to receive(:require_token).and_return('token')
      allow(subject).to receive(:client).and_return(client)
      allow(subject).to receive(:settings).and_return(valid_settings)
      expect(subject).to receive(:current_master=).with('some_master')
      expect(client).to receive(:get).with('grids')
      subject.run(['some_master'])
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
kontena-cli-0.15.4 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-0.15.4.rc2 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-0.15.4.rc1 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-0.15.4.pre1 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-0.15.3 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-0.15.2 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-0.15.1 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-0.15.0 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-0.15.0.rc3 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-0.15.0.rc2 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-0.15.0.rc1 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-0.14.7 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-0.14.6 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-0.14.5 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-0.14.4 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-0.14.3 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-0.14.2 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-0.14.1 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-0.14.0 spec/kontena/cli/master/use_command_spec.rb
kontena-cli-0.13.4 spec/kontena/cli/master/use_command_spec.rb