File: init_spec.rb

package info (click to toggle)
puppet 5.5.22-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 21,316 kB
  • sloc: ruby: 254,925; sh: 1,608; xml: 219; makefile: 153; sql: 103
file content (45 lines) | stat: -rw-r--r-- 1,301 bytes parent folder | download
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
require 'spec_helper'

provider = Puppet::Type.type(:service).provider(:init)

describe provider do
  describe "when running on FreeBSD" do
    before :each do
      allow(Facter).to receive(:value).with(:operatingsystem).and_return('FreeBSD')
    end

    it "should set its default path to include /etc/rc.d and /usr/local/etc/rc.d" do
      expect(provider.defpath).to eq(["/etc/rc.d", "/usr/local/etc/rc.d"])
    end
  end

  describe "when running on HP-UX" do
    before :each do
      allow(Facter).to receive(:value).with(:operatingsystem).and_return('HP-UX')
    end

    it "should set its default path to include /sbin/init.d" do
      expect(provider.defpath).to eq("/sbin/init.d")
    end
  end

  describe "when running on Archlinux" do
    before :each do
      allow(Facter).to receive(:value).with(:operatingsystem).and_return('Archlinux')
    end

    it "should set its default path to include /etc/rc.d" do
      expect(provider.defpath).to eq("/etc/rc.d")
    end
  end

  describe "when not running on FreeBSD, HP-UX or Archlinux" do
    before :each do
      allow(Facter).to receive(:value).with(:operatingsystem).and_return('RedHat')
    end

    it "should set its default path to include /etc/init.d" do
      expect(provider.defpath).to eq("/etc/init.d")
    end
  end
end