1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
require 'spec_helper'
require 'puppet/application/help'
describe "puppet help" do
let(:app) { Puppet::Application[:help] }
it "generates global help" do
expect {
app.run
}.to exit_with(0)
.and output(Regexp.new(Regexp.escape(<<~END), Regexp::MULTILINE)).to_stdout
Usage: puppet <subcommand> [options] <action> [options]
Available subcommands:
END
end
Puppet::Face.faces.sort.each do |face_name|
next if face_name == :key
context "for #{face_name}" do
it "generates help" do
app.command_line.args = ['help', face_name]
expect {
app.run
}.to exit_with(0)
.and output(/USAGE: puppet #{face_name} <action>/).to_stdout
end
Puppet::Face[face_name, :current].actions.sort.each do |action_name|
it "for action #{action_name}" do
app.command_line.args = ['help', face_name, action_name]
expect {
app.run
}.to exit_with(0)
.and output(/USAGE: puppet #{face_name}/).to_stdout
end
end
end
end
end
|