Sha256: 3f8ed05b90304fa69ae7d71be3688fb3bb7ffb0a4b9d360d26bfff1d2f2f85c5

Contents?: true

Size: 1.19 KB

Versions: 15

Compression:

Stored size: 1.19 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
    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
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
kontena-cli-1.1.6 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.1.5 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.1.5.rc3 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.1.5.rc2 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.1.5.rc1 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.1.4 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.1.3 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.1.2 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.1.2.rc2 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.1.2.rc1 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.1.1 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.1.1.rc1 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.1.0 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.1.0.rc2 spec/kontena/cli/services/containers_command_spec.rb
kontena-cli-1.1.0.rc1 spec/kontena/cli/services/containers_command_spec.rb