File: rdoc_spec.rb

package info (click to toggle)
puppet-agent 7.23.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 19,092 kB
  • sloc: ruby: 245,074; sh: 456; makefile: 38; xml: 33
file content (55 lines) | stat: -rw-r--r-- 1,786 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
45
46
47
48
49
50
51
52
53
54
55
require 'spec_helper'

require 'puppet/util/rdoc'
require 'rdoc/rdoc'

describe Puppet::Util::RDoc do
  describe "when generating RDoc HTML documentation" do
    before :each do
      @rdoc = double('rdoc')
      allow(RDoc::RDoc).to receive(:new).and_return(@rdoc)
    end

    it "should tell RDoc to generate documentation using the Puppet generator" do
      expect(@rdoc).to receive(:document).with(include("--fmt").and(include("puppet")))

      Puppet::Util::RDoc.rdoc("output", [])
    end

    it "should tell RDoc to be quiet" do
      expect(@rdoc).to receive(:document).with(include("--quiet"))

      Puppet::Util::RDoc.rdoc("output", [])
    end

    it "should pass charset to RDoc" do
      expect(@rdoc).to receive(:document).with(include("--charset").and(include("utf-8")))

      Puppet::Util::RDoc.rdoc("output", [], "utf-8")
    end

    it "should tell RDoc to use the given outputdir" do
      expect(@rdoc).to receive(:document).with(include("--op").and(include("myoutputdir")))

      Puppet::Util::RDoc.rdoc("myoutputdir", [])
    end

    it "should tell RDoc to exclude all files under any modules/<mod>/files section" do
      expect(@rdoc).to receive(:document).with(include("--exclude").and(include("/modules/[^/]*/files/.*$")))

      Puppet::Util::RDoc.rdoc("myoutputdir", [])
    end

    it "should tell RDoc to exclude all files under any modules/<mod>/templates section" do
      expect(@rdoc).to receive(:document).with(include("--exclude").and(include("/modules/[^/]*/templates/.*$")))

      Puppet::Util::RDoc.rdoc("myoutputdir", [])
    end

    it "should give all the source directories to RDoc" do
      expect(@rdoc).to receive(:document).with(include("sourcedir"))

      Puppet::Util::RDoc.rdoc("output", ["sourcedir"])
    end
  end
end