Sha256: 352b094ce9597bb2f86d3f3e4b69be0072c51bd48ee3d8c48469def84b65d012

Contents?: true

Size: 1.21 KB

Versions: 5

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe Conjur::Command::Layers, logged_in: true do
  let(:layer) { double(:layer) }
  
  [ "layer hosts add", "layer:hosts:add" ].each do |cmd|
    describe_command "#{cmd} the-layer the-host" do
      it "adds a host id to the layer" do
        Conjur::API.any_instance.should_receive(:layer).with("the-layer").and_return layer
        layer.should_receive(:add_host).with("the-account:host:the-host")
  
        expect { invoke }.to write("Host added")
      end
    end
    describe_command "#{cmd} the-layer host:the-host" do
      it "adds a qualified host id to the layer" do
        Conjur::API.any_instance.should_receive(:layer).with("the-layer").and_return layer
        layer.should_receive(:add_host).with("host:the-host")
  
        expect { invoke }.to write("Host added")
      end
    end
  end

  [ "layer hosts remove", "layer:hosts:remove" ].each do |cmd|
    describe_command "#{cmd} the-layer the-host" do
      it "adds a host to the layer" do
        Conjur::API.any_instance.should_receive(:layer).with("the-layer").and_return layer
        layer.should_receive(:remove_host).with("the-account:host:the-host")
  
        expect { invoke }.to write("Host removed")
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
conjur-cli-4.14.0 spec/command/layers_spec.rb
conjur-cli-4.13.1 spec/command/layers_spec.rb
conjur-cli-4.12.0 spec/command/layers_spec.rb
conjur-cli-4.10.3 spec/command/layers_spec.rb
conjur-cli-4.10.1 spec/command/layers_spec.rb