Sha256: c46dbe2b16aad18750c6b7973efd40f75cfd0905084585771d9698367b141048

Contents?: true

Size: 1.01 KB

Versions: 71

Compression:

Stored size: 1.01 KB

Contents

#! /usr/bin/env ruby
require 'spec_helper'
require 'puppet/application/facts'

describe Puppet::Application::Facts do
  before :each do
    subject.command_line.stubs(:subcommand_name).returns 'facts'
  end

  it "should fail if no key is given to find" do
    subject.command_line.stubs(:args).returns %w{find}
    expect {
      expect { subject.run }.to exit_with 1
    }.to have_printed /Error: puppet facts find takes 1 argument, but you gave 0/
    @logs.first.to_s.should =~ /puppet facts find takes 1 argument, but you gave 0/
  end

  it "should return facts if a key is given to find" do
    Puppet[:stringify_facts] = false
    Puppet::Node::Facts.indirection.reset_terminus_class
    Puppet::Node::Facts.indirection.expects(:find).returns(Puppet::Node::Facts.new('whatever', {}))
    subject.command_line.stubs(:args).returns %w{find whatever --render-as yaml}

    expect {
      expect {
        subject.run
      }.to exit_with 0
    }.to have_printed(/object:Puppet::Node::Facts/)

    @logs.should be_empty
  end
end

Version data entries

71 entries across 71 versions & 1 rubygems

Version Path
puppet-3.8.7 spec/unit/application/facts_spec.rb
puppet-3.8.7-x86-mingw32 spec/unit/application/facts_spec.rb
puppet-3.8.7-x64-mingw32 spec/unit/application/facts_spec.rb
puppet-3.8.6 spec/unit/application/facts_spec.rb
puppet-3.8.6-x86-mingw32 spec/unit/application/facts_spec.rb
puppet-3.8.6-x64-mingw32 spec/unit/application/facts_spec.rb
puppet-3.8.5 spec/unit/application/facts_spec.rb
puppet-3.8.5-x86-mingw32 spec/unit/application/facts_spec.rb
puppet-3.8.5-x64-mingw32 spec/unit/application/facts_spec.rb
puppet-3.8.4 spec/unit/application/facts_spec.rb
puppet-3.8.4-x86-mingw32 spec/unit/application/facts_spec.rb
puppet-3.8.4-x64-mingw32 spec/unit/application/facts_spec.rb
puppet-3.8.3 spec/unit/application/facts_spec.rb
puppet-3.8.3-x86-mingw32 spec/unit/application/facts_spec.rb
puppet-3.8.3-x64-mingw32 spec/unit/application/facts_spec.rb
puppet-3.8.2 spec/unit/application/facts_spec.rb
puppet-3.8.2-x86-mingw32 spec/unit/application/facts_spec.rb
puppet-3.8.2-x64-mingw32 spec/unit/application/facts_spec.rb
puppet-3.8.1 spec/unit/application/facts_spec.rb
puppet-3.8.1-x86-mingw32 spec/unit/application/facts_spec.rb