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-0.16.0.rc3 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-0.16.0.rc2 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-0.16.0.rc1 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-0.16.0.pre9 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-0.16.0.pre8 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-0.16.0.pre7 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-0.16.0.pre6 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-0.15.5 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-0.15.5.rc2 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-0.15.5.rc1 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-0.16.0.pre5 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-0.16.0.pre4 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-0.16.0.pre3 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-0.16.0.pre2 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-0.16.0.pre1 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-0.15.4 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-0.15.4.rc2 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-0.15.4.rc1 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-0.15.4.pre1 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-0.15.3 spec/kontena/cli/services/containers_command_spec.rb