Sha256: 003883e0cdb548cd6298c58b01cf732943ef55f100810caded68edf148e035d1

Contents?: true

Size: 1.22 KB

Versions: 83

Compression:

Stored size: 1.22 KB

Contents

require_relative "../../../spec_helper"
require "kontena/cli/services/containers_command"

describe Kontena::Cli::Services::ContainersCommand do

  include ClientHelpers

  describe '#execute' do

    before(:each) do
      allow(client).to receive(:get).and_return({
        'containers' => []
      })
    end

    it 'requires api url' do
      expect(subject).to receive(:require_api_url).once
      subject.run(['service-a'])
    end

    it 'requires token' do
      expect(subject).to receive(:require_token).and_return(token)
      subject.run(['service-a'])
    end

    it 'to not throw on missing "overlay_cidr" property' do
      allow(client).to receive(:get).and_return({
        'containers' => [
          {'id' => "service-a-id", 'node' => {'public_ip' => ""}}
        ]
      })
      expect {
        subject.run(['service-a'])
      }.to_not raise_error(NoMethodError)
    end

    it 'to not throw on nil "overlay_cidr" property' do
      allow(client).to receive(:get).and_return({
        'containers' => [
          {'id' => "service-a-id", 'node' => {'public_ip' => ""}, 'overlay_cidr' => nil}
        ]
      })
      expect {
        subject.run(['service-a'])
      }.to_not raise_error(NoMethodError)
    end
  end
end

Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
kontena-cli-1.1.0.pre1 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.0.6 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.0.6.rc1 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.0.5 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.0.5.rc1 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.0.5.pre1 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.0.4 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.0.4.rc2 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.0.4.rc1 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.0.3 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.0.3.rc1 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.0.2 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.0.2.rc2 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.0.2.rc1 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.0.2.pre1 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.0.1 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.0.1.rc3 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.0.1.rc2 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.0.1.rc1 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.0.0 spec/kontena/cli/services/containers_command_spec.rb