Sha256: 09a3cdaa9dab4405140140f16054f0956d9759c228f23c7e23a8e17883624e3c

Contents?: true

Size: 1006 Bytes

Versions: 28

Compression:

Stored size: 1006 Bytes

Contents

require 'spec_helper'
require 'r10k/action/puppetfile/check'

describe R10K::Action::Puppetfile::Check do

  subject { described_class.new({root: "/some/nonexistent/path"}, []) }

  let(:puppetfile) { instance_double('R10K::Puppetfile') }

  before { allow(R10K::Puppetfile).to receive(:new).with("/some/nonexistent/path", nil, nil).and_return(puppetfile) }

  it_behaves_like "a puppetfile action"

  it "prints 'Syntax OK' when the Puppetfile syntax could be validated" do
    expect(puppetfile).to receive(:load!)
    expect($stderr).to receive(:puts).with("Syntax OK")
    subject.call
  end

  it "prints an error message when validating the Puppetfile syntax raised an error" do
    expect(puppetfile).to receive(:load!).and_raise(R10K::Error.new("Boom!"))
    expect(R10K::Errors::Formatting).to receive(:format_exception).with(instance_of(R10K::Error), anything).and_return("Formatted error message")
    expect($stderr).to receive(:puts).with("Formatted error message")
    subject.call
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
r10k-2.6.9 spec/unit/action/puppetfile/check_spec.rb
r10k-2.6.8 spec/unit/action/puppetfile/check_spec.rb
r10k-2.6.7 spec/unit/action/puppetfile/check_spec.rb
r10k-2.6.6 spec/unit/action/puppetfile/check_spec.rb
r10k-2.6.5 spec/unit/action/puppetfile/check_spec.rb
r10k-2.6.4 spec/unit/action/puppetfile/check_spec.rb
r10k-2.6.3 spec/unit/action/puppetfile/check_spec.rb
r10k-2.6.2 spec/unit/action/puppetfile/check_spec.rb
r10k-2.6.1 spec/unit/action/puppetfile/check_spec.rb
r10k-2.6.0 spec/unit/action/puppetfile/check_spec.rb
r10k-2.5.5 spec/unit/action/puppetfile/check_spec.rb
r10k-2.5.4 spec/unit/action/puppetfile/check_spec.rb
r10k-2.5.3 spec/unit/action/puppetfile/check_spec.rb
r10k-2.5.2 spec/unit/action/puppetfile/check_spec.rb
r10k-2.5.1 spec/unit/action/puppetfile/check_spec.rb
r10k-2.4.5 spec/unit/action/puppetfile/check_spec.rb
r10k-2.3.1 spec/unit/action/puppetfile/check_spec.rb
r10k-2.4.4 spec/unit/action/puppetfile/check_spec.rb
r10k-2.5.0 spec/unit/action/puppetfile/check_spec.rb
r10k-2.4.3 spec/unit/action/puppetfile/check_spec.rb