Sha256: 23dd38c0a56965a9bb64ed2bbe195fc1a475c14ab5fa2cf2f7b5ad5d72d02740

Contents?: true

Size: 1.08 KB

Versions: 10

Compression:

Stored size: 1.08 KB

Contents

#! /usr/bin/env ruby
require 'spec_helper'
require 'puppet/face'

describe Puppet::Face[:config, '0.0.1'] do
  it "prints a single setting without the name" do
    Puppet[:trace] = true

    subject.expects(:puts).with(true)

    subject.print("trace").should be_nil
  end

  it "prints multiple settings with the names" do
    Puppet[:trace] = true
    Puppet[:syslogfacility] = "file"

    subject.expects(:puts).with("trace = true")
    subject.expects(:puts).with("syslogfacility = file")

    subject.print("trace", "syslogfacility")
  end

  it "prints the setting from the selected section" do
    Puppet.settings.parse_config(<<-CONF)
    [other]
    syslogfacility = file
    CONF

    subject.expects(:puts).with("file")

    subject.print("syslogfacility", :section => "other")
  end

  it "should default to all when no arguments are given" do
    subject.expects(:puts).times(Puppet.settings.to_a.length)

    subject.print
  end

  it "prints out all of the settings when asked for 'all'" do
    subject.expects(:puts).times(Puppet.settings.to_a.length)

    subject.print('all')
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
puppet-3.5.1 spec/unit/face/config_spec.rb
puppet-3.5.1-x86-mingw32 spec/unit/face/config_spec.rb
puppet-3.5.1.rc1 spec/unit/face/config_spec.rb
puppet-3.5.1.rc1-x86-mingw32 spec/unit/face/config_spec.rb
puppet-3.5.0.rc3 spec/unit/face/config_spec.rb
puppet-3.5.0.rc3-x86-mingw32 spec/unit/face/config_spec.rb
puppet-3.5.0.rc2 spec/unit/face/config_spec.rb
puppet-3.5.0.rc2-x86-mingw32 spec/unit/face/config_spec.rb
puppet-3.5.0.rc1 spec/unit/face/config_spec.rb
puppet-3.5.0.rc1-x86-mingw32 spec/unit/face/config_spec.rb