Sha256: a868f13eb9fefdfab1b22350d12779023268a040d6343bf9c165a182aafa4a1e

Contents?: true

Size: 1.08 KB

Versions: 62

Compression:

Stored size: 1.08 KB

Contents

require_relative "../../../../spec_helper"
require "kontena/cli/grids/trusted_subnet_command"
require "kontena/cli/grids/trusted_subnets/remove_command"

describe Kontena::Cli::Grids::TrustedSubnets::RemoveCommand do

  include ClientHelpers

  describe '#execute' do
    it 'requires api url' do
      expect(subject).to receive(:require_api_url).once
      subject.run(['--force', 'grid', 'subnet'])
    end

    it 'requires token' do
      expect(subject).to receive(:require_token).and_return(token)
      subject.run(['--force', 'grid', 'subnet'])
    end

    it 'requires grid as param' do
      expect {
        subject.run([])
      }.to raise_error(Clamp::UsageError)
    end

    it 'removes subnet from grid' do
      allow(client).to receive(:get).with("grids/my-grid").and_return(
        'trusted_subnets' => ['192.168.12.0/24', '192.168.50.0/24']
      )
      expect(client).to receive(:put).with(
        'grids/my-grid', hash_including({trusted_subnets: [
          '192.168.12.0/24'
        ]})
      )
      subject.run(['--force', 'my-grid', '192.168.50.0/24'])
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
kontena-cli-1.1.6 spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb
kontena-cli-1.1.5 spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb
kontena-cli-1.1.5.rc3 spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb
kontena-cli-1.1.5.rc2 spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb
kontena-cli-1.1.5.rc1 spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb
kontena-cli-1.1.4 spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb
kontena-cli-1.1.3 spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb
kontena-cli-1.1.2 spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb
kontena-cli-1.1.2.rc2 spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb
kontena-cli-1.1.2.rc1 spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb
kontena-cli-1.1.1 spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb
kontena-cli-1.1.1.rc1 spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb
kontena-cli-1.1.0 spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb
kontena-cli-1.1.0.rc2 spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb
kontena-cli-1.1.0.rc1 spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb
kontena-cli-1.1.0.pre1 spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb
kontena-cli-1.0.6 spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb
kontena-cli-1.0.6.rc1 spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb
kontena-cli-1.0.5 spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb
kontena-cli-1.0.5.rc1 spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb