Sha256: 458b19e56138560e25f7c0f91b0c9dd4f74b3de5caf3ad0cc96289e3f0d44fd8
Contents?: true
Size: 989 Bytes
Versions: 36
Compression:
Stored size: 989 Bytes
Contents
require 'spec_helper' require 'puppet/ssl/certificate_authority/autosign_command' describe Puppet::SSL::CertificateAuthority::AutosignCommand do let(:csr) { double('csr', :name => 'host', :to_s => 'CSR PEM goes here') } let(:decider) { Puppet::SSL::CertificateAuthority::AutosignCommand.new('/autosign/command') } it "returns true if the command succeeded" do executes_the_command_resulting_in(0) expect(decider.allowed?(csr)).to eq(true) end it "returns false if the command failed" do executes_the_command_resulting_in(1) expect(decider.allowed?(csr)).to eq(false) end def executes_the_command_resulting_in(exitstatus) expect(Puppet::Util::Execution).to receive(:execute). with(['/autosign/command', 'host'], hash_including(:stdinfile => anything, :combine => true, :failonfail => false)). and_return(Puppet::Util::Execution::ProcessOutput.new('', exitstatus)) end end
Version data entries
36 entries across 36 versions & 1 rubygems