Sha256: f59b25c0fd4c331a1fd52166a69f33e2fe51d2fcc6a42525f8e4952aef6d2121
Contents?: true
Size: 1.03 KB
Versions: 95
Compression:
Stored size: 1.03 KB
Contents
require_relative "../../../../spec_helper" require "kontena/cli/grids/trusted_subnet_command" require "kontena/cli/grids/trusted_subnets/add_command" describe Kontena::Cli::Grids::TrustedSubnets::AddCommand do include ClientHelpers describe '#execute' do it 'requires api url' do expect(subject).to receive(:require_api_url).once subject.run(['grid', 'subnet']) end it 'requires token' do expect(subject).to receive(:require_token).and_return(token) subject.run(['grid', 'subnet']) end it 'requires grid as param' do expect { subject.run([]) }.to raise_error(Clamp::UsageError) end it 'adds subnet to grid' do allow(client).to receive(:get).with("grids/my-grid").and_return( 'trusted_subnets' => ['192.168.12.0/24'] ) expect(client).to receive(:put).with( 'grids/my-grid', hash_including({trusted_subnets: [ '192.168.12.0/24', '10.12.0.0/19' ]}) ) subject.run(['my-grid', '10.12.0.0/19']) end end end
Version data entries
95 entries across 95 versions & 1 rubygems