File: help_spec.rb

package info (click to toggle)
puppet-agent 8.10.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 27,404 kB
  • sloc: ruby: 286,820; sh: 492; xml: 116; makefile: 88; cs: 68
file content (44 lines) | stat: -rw-r--r-- 1,090 bytes parent folder | download | duplicates (3)
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